cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Jonmoon74
Regular Visitor

Set DropDown value based on number in another field

Hi,

 

I have a PowerApps app based from a SharePoint List and in it I have one field (Outcome) based on a dropdown list, what I am trying to do is:

If the user enters the number 3 in another field of type number, i want to set the Outcome dropdown value to "Declined" but otherwise leave the Outcome value to whatever the user chooses from the dropdown.

I've read so many threads now online but none work as I can't seem to get Powerapps to access the number in the second datacard.

I have checked that the second field is definitely of type Number, but the only parameter i get to access the data in the datacard is DataCardValue177.Text and that fails as the value is not of type text

7 REPLIES 7
WarrenBelz
Super User
Super User

Hi @Jonmoon74 ,

You did not provide your filter code, but the test you need is

Value(DataCardValue177.Text)=3

or

DataCardValue177.Text="3"

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Thanks for the reply @WarrenBelz, but when i try and use that in an If statement on the Default property of the DropDown field, i get an error that the formula uses scope that is currently unsupported and the formula cannot be evaluated

Prakash4691
Super User
Super User

Hi @Jonmoon74 ,

 

On onchange property of text input save the status in updatecontext.

 

if it is equal to 3 set to active, in your case it would be declined.

 

UpdateContext({StatusValue: If(Value(TextInput2.Text) = 3, NewStatusReason.'Active ')})

 

Then in Default property of dropdown set updatecontext variable "StatusValue".

 

 

Regards,

Prakash

Hi Prakash,

 

I'm not following how NewStatusReason.'Active ' would set Declined from the dropdown list, am i missing something?

Prakash4691
Super User
Super User

Hi @Jonmoon74 ,

 

It is just an example, newstatus reason is the list of values available in my dropdown, active is the value which will get set based on condition.

 

 

Regards,

Prakash

@Jonmoon74 ,

One of those two has to be valid if you have a number in there.

If you want me to help you here, please supply the code you are using in Text.

Jonmoon74
Regular Visitor

Hi @A-Warr & @Prakash4691 ,

 

Thank you both for trying to help, but none of the above seems to work, there must be something really simple I am missing, but since the setting of Declined in the Outcome field is needed to trigger a power automate flow, I have for now just added an extra clause to the automate flow to also pick up the value of 3 in this field and mark as Declined outside the app. - not as elegant as doing it inside the app but does the job while i root around for the bug that is stopping things

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (4,531)