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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Zoom and FormMode enum...
Power Apps
Answered

Zoom and FormMode enums data-type differ from other enums in PowerApps

(0) ShareShare
ReportReport
Posted on by 1,594

Hi,

 

When you use the ClearCollect (or Collect) functions to create a collection, in all records of the collection, properties with the same name must be of same data type.

In other words, the following code...

ClearCollect(
 {
 name: "Height",
 value: 300
 },
 {
 name: "Text",
 value: "Default text"
 }
)

...leads to an error because the value property cannot be an integer in one record and a string in another one.

 

I created a collection regrouping all controls enums in PowerApps:

ClearCollect(
 gloControlEnums,
 {
 name: "Font",
 values: Table(
 {
 name: "Arial",
 value: Font.Arial
 },
 {
 name: "Courier New",
 value: Font.'Courier New'
 },
 {
 name: "Dancing Script",
 value: Font.'Dancing Script'
 },
 {
 name: "Georgia",
 value: Font.Georgia
 },
 {
 name: "Great Vibes",
 value: Font.'Great Vibes'
 },
 {
 name: "Lato",
 value: Font.Lato
 },
 {
 name: "Lato Black",
 value: Font.'Lato Black'
 },
 {
 name: "Lato Hairline",
 value: Font.'Lato Hairline'
 },
 {
 name: "Lato Light",
 value: Font.'Lato Light'
 },
 {
 name: "Open Sans",
 value: Font.'Open Sans'
 },
 {
 name: "Open Sans Condensed",
 value: Font.'Open Sans Condensed'
 },
 {
 name: "Patrick Hand",
 value: Font.'Patrick Hand'
 },
 {
 name: "Segoe UI",
 value: Font.'Segoe UI'
 },
 {
 name: "Verdana",
 value: Font.Verdana
 }
 )
 },
 {
 name: "FontWeight",
 values: Table(
 {
 name: "Bold",
 value: FontWeight.Bold
 },
 {
 name: "Semibold",
 value: FontWeight.Semibold
 },
 {
 name: "Normal",
 value: FontWeight.Normal
 },
 {
 name: "Lighter",
 value: FontWeight.Lighter
 }
 )
 },
 {
 name: "BorderStyle",
 values: Table(
 {
 name: "None",
 value: BorderStyle.None
 },
 {
 name: "Dashed",
 value: BorderStyle.Dashed
 },
 {
 name: "Dotted",
 value: BorderStyle.Dotted
 },
 {
 name: "Solid",
 value: BorderStyle.Solid
 }
 )
 },

etc...

What is really strange is that among the 21 enums in PowerApps, two of them won't fit into the collection above:

  • Zoom (in the PDF Viewer control)
  • FormMode (in the Edit Form control)

I assume this is due to the fact that, for some strange reason, the data type of these 2 enums differ from all 19 others. PowerApps shows this error when adding one of these 2 enums to my collection above:

 

Image 4.png

 

Anyone from the PowerApps team can help me on this ?

 

Thanks,

 

Emmanuel

Categories:
  • Verified answer
    CarlosFigueira Profile Picture
    Microsoft Employee on at

    The members of PowerApps enumerations can be either strings or numbers. The easiest way to find out which is which is to use a label to look at the enum value:

    ForumPost001.PNG

    or

    ForumPost002.PNG

    If you want to have a collection with all enums in PowerApps, you can convert the numeric ones to text, using the Text function:

    ClearCollect(
     gloControlEnums,
     {
     name: "FontWeight",
     values: Table(
     { name: "Bold", value: FontWeight.Bold },
     { name: "Semibold", value: FontWeight.Semibold },
     { name: "Normal", value: FontWeight.Normal },
     { name: "Lighter", value: FontWeight.Lighter }
     )
     },
     {
     name: "Zoom",
     values: Table(
     { name: "FitBoth", value: Text(Zoom.FitBoth) },
     { name: "FitHeight", value: Text(Zoom.FitHeight) },
     { name: "FitWidth", value: Text(Zoom.FitWidth) }
     )
     }
    )

    Notice that there are many other numeric enumerations in PowerApps (StartOfWeek, ErrorKind, PDFPasswordState, LoadingSpinner, ...)

    Hope this helps!

  • R3dKap Profile Picture
    1,594 on at

    Thank you @CarlosFigueira, I'll use the Text() function indeed...

     

    Another question/remark: it's interesting to see how you formatted your code in your last post. I would say it's an intermediate format between the FORMAT TEXT function and the REMOVE FORMATTING function that we can find at the bottom of the code editor.

    The FORMAT TEXT function produces something like the code I put in my original post (it can then generate very quickly many pages and pages of code) and the REMOVE FORMATTING pretty much does a "minify" on your code (but which is unreadable).

    What I want to point out here is that I find the intermediate formatting very handy and easy to read. Do you know if there is any chance that we could use this type of code formatting one day in the code editor ?

    Emmanuel

  • CarlosFigueira Profile Picture
    Microsoft Employee on at

    For my post I did format it "by hand" by removing some lines that I think are too much. I agree with you, this format is more readable than the one that we get with the "Format Text" feature. Can you create a new feature request in the PowerApps Ideas board, I've heard this feedback before, and if we have more people voting up for it (please let me know when you create it and I'll vote for it as well), then it will get a higher priority in the backlog for features.

  • R3dKap Profile Picture
    1,594 on at

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 411 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 338

#3
WarrenBelz Profile Picture

WarrenBelz 256 Most Valuable Professional

Last 30 days Overall leaderboard