web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Declare User Defined D...
Power Apps
Suggested Answer

Declare User Defined Data Types for Powerapps Canvas

(2) ShareShare
ReportReport
Posted on by 8
Hi,
 
I saw in the latest update that powerapps supports custom data types to be used in UDFs. Can you help describe how to declare them
 
Categories:
I have the same question (0)
  • adithyaselv Profile Picture
    Microsoft Employee on at
    Hi,

    You can declare a user-defined time in the Formulas property similar to UDF and then use it in UDF . Please find a simple example below.

    -----
     
    //Record type
    Point := Type({x: Number, y: Number});
     
    // UDF to compute distance between two points
    distance(a:Point,b:Point):Number = Sqrt(Power(b.x - a.x, 2) + Power(b.y-a.y, 2));
     
    //Table type
    Points := Type([Point]);
     
    // UDF to check if the given table of points contains a particular point
    containsPoint(points: Points, target:Point): Boolean = CountIf(points, ThisRecord.x = target.x && ThisRecord.y = target.y) > 0;

    ----

    notice that you need to use := to declare user-defined type. Type is a special function used to construct a type definition.
  • Suggested answer
    adithyaselv Profile Picture
    Microsoft Employee on at
    Hi,

    You can declare a user-defined time in the Formulas property similar to UDF and then use it in UDF . Please find a simple example below.

    -----
     
    //Record type
    Point := Type({x: Number, y: Number});
     
    // UDF to compute distance between two points
    distance(a:Point,b:Point):Number = Sqrt(Power(b.x - a.x, 2) + Power(b.y-a.y, 2));
     
    //Table type
    Points := Type([Point]);
     
    // UDF to check if the given table of points contains a particular point
    containsPoint(points: Points, target:Point): Boolean = CountIf(points, ThisRecord.x = target.x && ThisRecord.y = target.y) > 0;

    ----

    notice that you need to use := to declare user-defined type. Type is a special function used to construct a type definition.
  • IAmIntractable Profile Picture
    280 on at
    I don't believe this is a general release feature yet.
  • laveudelsilenci Profile Picture
    9 on at
    Please, Move this to General. It has not sense Formulas defined functions without defined types. 
    It is big evolution of PowerApps, to isolate code. 
    Publish it as preview as soon as possible, it it works perfectly.  

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard