Hi,
I have dropdown where property default is set to a certain value.
Default property - If ( DataCardvalue1.Selected.Value = "Canada", "Justin Trudeau", If(DataCardValue1.Selected.Value = "USA", "Joe Biden))
Items property = ["Justin Trudeau","Joe Biden"]
So I want it to default based on DataCardValue1. But I want to be able to override the default.
So when I override and switch the dropdown to Joe Biden even though datacardvalue1 = Canada, it does save in the backend sharepoint successfully.
But it doesnt show, Joe Biden in the item. It will always default to Justin Trudeau.
IS there anyway I can get it to show the accurate value?
Hi @wonka1234
I would suggest to use a variable for what you want to achieve.
In the DataCardvalue1.Selected.Value set the OnChange property to:
UpdateContext({varCountry: Self.SelectedText.Value})
Then you can also use this variable in the screen to change the default value if it exists in the dropdown.
In the Default property of the other dropdown you change the code to:
If(
varCountry = "Canada",
"Justin Trudeau",
varCountry = "USA",
"Joe Biden"
)
You don't need nested if statements you can directly add a logic behind one logic.
Then on a button you can update the variable to override the existsing value:
UpdateContext({varCountry: "USA"})
Hope this help you.
If you have any questions or feedback, please let me know. Have a great day! 😊
-----------------------
PowerYsa Power Platform Enthusiast [LinkedIn] | [Youtube]
I love to share my knowledge and learn from others. If you find my posts helpful, please give them a thumbs up 👍 or mark them as a solution ✔️. You can also check out my [@PowerYSA] for some cool solutions and insights. Feel free to connect with me on any of the platforms above. Cheers! 🍻
can you check Item property of your form ?
it works on edit mode if the form is connected to an item,
getting selected value of form works only with Form Mode View or New
thanks, i think its close, I cant seem to get it to work! its still showing my First Submit of that field.
It looks like UserSelection keeps going back to blank when i go back to the screen!
each screen has an onvisible property
@mmbr1606 what is OnVisible of Screen or DataCard? I see Visible on my datacard but cant put anything other then true or false!
try this
OnVisible of Screen or DataCard: Initialize a variable:
UpdateContext({UserSelection: ""})
OnChange of Dropdown: Update the variable with the user's selection:
UpdateContext({UserSelection: Dropdown.Selected.Value})
default dropdown
If(IsBlank(UserSelection),
If(DataCardValue1.Selected.Value = "Canada", "Justin Trudeau",
If(DataCardValue1.Selected.Value = "USA", "Joe Biden")),
UserSelection)
Let me know if my answer helped solving your issue.
If it did please accept as solution and give it a thumbs up so we can help others in the community.
Greetings
WarrenBelz
146,524
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,906
Most Valuable Professional