cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
egardecki
Frequent Visitor

working with choice field and combobox/label

I have a SharePoint choice field that is being displayed in the powerapp as a combobox datacard.  What I'd like to do is a conditional statement that changes the text that is displayed as well as it's color.  So if the value = "Yes", display "Complete" and change the text color to green.  I can do this for other types of data but can't seem to figure this out with the choice field.  I tried many things and plenty of research and can't seem to figure it out.  I'm not even sure which property I should be editing for this for the combobox datacard. 

 

I also tried changing to a label datacard and can't get it right either.

 

Logically, I figure I need to make use of Parent.Default.Selected.Value but it errors and I do not know how else to display the selected value differently.  I could probably figure out the color change after the text is changed but still hung up on that part.

 

Suggestions?

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions

You cannot change the values available in a Sharepoint option set to display something different in the app, you would have to change them in the data source. 

If you want to have the user see something different when running the app and not allow them to change it you could put a label over top of the combobox and set it's visible property to:

If(comboboxname.Selected.Value = "Yes", false, true)

 

---
Please hit the "Accept as Solution" button if my post answered your question! If my post was helpful please consider giving it a "Thumbs Up."

View solution in original post

6 REPLIES 6
SeanHenderson
Impactful Individual
Impactful Individual

@egardecki 

Sorry, just to confirm, you have a dropdown combobox and you want users to select "Yes" but then see "Complete" even though "Complete" is not one of the selections?

I am just displaying the value at this time. Unsure I will allow changing it just yet. So I want to see what the value is and then display a different word.

The combobox datacard showed up automatically when starting the app from SP. Prefer to stick with that in case i do allow editing but open to other options.

Thanks!

You cannot change the values available in a Sharepoint option set to display something different in the app, you would have to change them in the data source. 

If you want to have the user see something different when running the app and not allow them to change it you could put a label over top of the combobox and set it's visible property to:

If(comboboxname.Selected.Value = "Yes", false, true)

 

---
Please hit the "Accept as Solution" button if my post answered your question! If my post was helpful please consider giving it a "Thumbs Up."

View solution in original post

Ok i will try that. Seems weird but should work.

So this is only with choice fields? I do not have the same issue with boolean.

Yes with Yes/No fields in SharePoint you can select FalseText and TrueText, but for Choice fields you can only set colors and text for whether or not a choice has been selected, not for individual choices. I would have to see the layout of your app, but I had something similar once where I just had a green check mark or red x appear based on the selections from the combobox.

 

---
Please hit the "Accept as Solution" button if my post answered your question! If my post was helpful please consider giving it a "Thumbs Up."

Hi @egardecki ,

If you just want the Displayed value within the ComboBox to be a different Text value, please consider take a try with the following workaround:

Set the DefaultSelectedItems property of the Choice field ComboBox in your Edit form to following:

If(
   ThisItem.ChoiceField.Value = "Yes",
   {
     Value: "Complete"
   },
    ThisItem.ChoiceField.Value = "No",
    {
      Value: "Not Complete"
    }
)

 

If you also want to change the color of the display text (e.g. "Complete") within the ComboBox, I afraid that there is no way to achieve your needs in PowerApps currently.

 

As an alternative solution, you could consider unlock the Choice field data card in your Edit form, then insert a Label into this data card to display the Text (e.g. "Complete") based on If condition. Then you could also change the Text color based on the If/Switch condition. Set the Text property of the Label to following:

Switch(
       ThisItem.ChoiceField.Value,
       "Yes", "Complete",
       "No", "Not Complete",
       ...
)

Set the Color property of the Label to following:

Switch(
       ThisItem.ChoiceField.Value,
       "Yes", Color.Green,
       "No", Color.Red,
       ...
)

 

Please consider take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,053)