Skip to main content

Notifications

Community site session details

Community site session details

Session Id : v+7k+SGsoXJtLPGGx8UtnN
Power Apps - Power Apps Experimental Features
Unanswered

Declare User Defined Data Types for Powerapps Canvas

Like (2) ShareShare
ReportReport
Posted on 1 Nov 2024 18:42:33 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
 
  • IAmIntractable Profile Picture
    245 on 08 Jan 2025 at 20:44:48
    Declare User Defined Data Types for Powerapps Canvas
    I don't believe this is a general release feature yet.
  • Suggested answer
    adithyaselv Profile Picture
    Microsoft Employee on 04 Jan 2025 at 23:19:17
    Declare User Defined Data Types for Powerapps Canvas
    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.
  • adithyaselv Profile Picture
    Microsoft Employee on 04 Jan 2025 at 23:08:58
    Declare User Defined Data Types for Powerapps Canvas
    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.

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,731 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,075 Most Valuable Professional

Leaderboard

Featured topics

Loading started