cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Nandy
Helper III
Helper III

Dropdown field display percentage value

Hi, I have use this code for gallery to display percentage value in support level :Text(Value(ThisItem.SupportLevel)*100)& "%". This works well in gallery but in edit form this function is not working in default. It shows 100% value as 1 n etc. Plz advise. Tq

 

Nandy_0-1609835866094.png

 

 

 

 

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
v-jefferni
Community Support
Community Support

Hi @Nandy ,

 

Within one screen, you could also create collection in that screen's OnVisible, other formulas could work no matter how many screens. See below demo:

90.gif

 

Hope this helps.

 

Best regards,

Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

RandyHayes
Super User III
Super User III

@Nandy 

Sorry for my delay on this.

I've been reading through all of your other posts to get some clues.

 

Here is most likely where your problems are coming from - You are using the Value function on a text that contains a % in it (i.e. your dropdown) to write back your data to your list.

PowerApps will automatically convert a 50% to .5 when you use that Value function.  And so, 100% will become 1

I believe this is compounded each time that you save the record.

 

If you want to avoid that conversion, you can change your formulas to use a match for the digits.

So, in your formula for your Patch (from your other post) change to this:

   {SupportLevel: Text(Value(Match(Dropdown2.Selected.Value, MultipleDigits).FullMatch))}

This will save the full percentage value chosen and not convert to decimal (i.e. divide by 100)

Ultimately then you will not have to multiply by 100 to get the value you want.

 

I hope I read through your other posts properly and related back to this one appropriately.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

View solution in original post

8 REPLIES 8
v-jefferni
Community Support
Community Support

Hi @Nandy ,

 

Could you please share more details about your scenario? Which data source are you working with? What field type is that SupportLevel field, Text or others?

 

As per the test that I just made, the formula worked well in an Edit Form, both with Dataverse Tables Text field and SharePoint list Text or Number type column.

88.png

 

Please make sure you have set the formula on the "DataCardValue" instead of on "SupportLevelDataCard".

 

Hope this helps.

 

Best regards,

Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.

Nandy
Helper III
Helper III

Hi @v-jefferni 

I used an excel data source which wen user click on the gallery ..user can edit the details in edit form. The support level (drop down) in edit form does not display as percentage and the original value is 100% but display as 1. Plz refer to the screenshot below. I had try the code in default but it is not working. Plz advise.

 

Nandy_0-1609835553287.png

 

RandyHayes
Super User III
Super User III

@Nandy 

Sorry to not pick this up in your other thread...

 

So, what is the Items property of your dropdown?  That will be the first clue as to why it is not showing you what you want.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Hi @RandyHayes 

 

Dropdown field Item is : Distinct(SiteSupportProfile,SupportLevel) 

Default : Text(Value(ThisItem.SupportLevel)*100)&"%" (not working works in gallery only in text)

It has view and edit form where view form will display the value of support level and once user click the edit function user can edit the support level accordingly. Only one screen has used for view and edit.  It shows as 0,0.75 and 1 instant of 0%, 75% and 100% . Plz advise. on this. Tq

v-jefferni
Community Support
Community Support

Hi @Nandy ,

 

Sorry but I have just noticed that it is a dropdown there. So would you like to let users select the actual number but display the number as percentage when the Form is in View Mode?

 

If so, as the workaround, you could add a Label in the SupportLevel Data Card, set it's Text property to:

Value(Text(Dropdown1.Selected.Result))*100 & "%"

also set it's Visible to:

If(Parent.DisplayMode = DisplayMode.View,true ,Parent.DisplayMode = DisplayMode.Edit,false)

and set the Dropdown's Visible to:

If(Parent.DisplayMode = DisplayMode.View,false ,Parent.DisplayMode = DisplayMode.Edit,true)

 

You could place the Label coincide with the Dropdown, so when Form's in Edit Mode the Dropdown will show and the Label will hide, when in View Mode then Dropdown will hide and show the Label. The percentage would display in the Label.

 

But WHY your formula could not work? Because although it LOOKS LIKE a Label in View Mode, it is still a Dropdown which could only display choices of the Items, convert a choice to percentage to display is not supported in PowerApps. If you really would like to convert the format, which would make you submit a percentage value to SP list, you will need to change the Items property which means totally change the items of the Dropdown:

Create a collection on the Form's OnVisible:

ClearCollect(colSupportLevel,AddColumn(Distinct(SiteSupportProfile,SupportLevel),"SupportLevel%",Text(Result)*100&"%"))

then use this collection as Items of the Dropdown.

 

Hope this helps.

 

Best regards,

Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.

Hi @v-jefferni ,

 

Thx for the reply. I believe that the above scenario involve two screen but mine is one screen only which viewing and editing will be only in screen 1. I need to do the support level attribute only in dropdown if I do add the label ...it wil involve two screen.

 

Thank you.

v-jefferni
Community Support
Community Support

Hi @Nandy ,

 

Within one screen, you could also create collection in that screen's OnVisible, other formulas could work no matter how many screens. See below demo:

90.gif

 

Hope this helps.

 

Best regards,

Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

RandyHayes
Super User III
Super User III

@Nandy 

Sorry for my delay on this.

I've been reading through all of your other posts to get some clues.

 

Here is most likely where your problems are coming from - You are using the Value function on a text that contains a % in it (i.e. your dropdown) to write back your data to your list.

PowerApps will automatically convert a 50% to .5 when you use that Value function.  And so, 100% will become 1

I believe this is compounded each time that you save the record.

 

If you want to avoid that conversion, you can change your formulas to use a match for the digits.

So, in your formula for your Patch (from your other post) change to this:

   {SupportLevel: Text(Value(Match(Dropdown2.Selected.Value, MultipleDigits).FullMatch))}

This will save the full percentage value chosen and not convert to decimal (i.e. divide by 100)

Ultimately then you will not have to multiply by 100 to get the value you want.

 

I hope I read through your other posts properly and related back to this one appropriately.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

View solution in original post

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (28,501)