I think this is a simple issue but struggling with If statements in a PowerApp with SharePoint datasource. I have the following fields:
Q1 Question is a Choice field with choices of 2,10, 20, 5000.
Q1 Answer is a text field.
I need to set the Field Q1 Answer to a value based on the choice made in Q1 Question.
I have read a bunch of articles on this and it is not totally clear how the field name should be set. I have tried a number of variations of the If statement but cannot get it to work, I constantly get the following error:
Expected Operator. We expect an Operator such as +,*, or & at this point in the formula.
My current attempt is as follows:
=if(Q1 Question.value = 2,"2", Q1 Question.value = 10,"3", Q1 Question.value = 20,"5", Q1 Question.value = 5000,"10")
I have placed this in the Text property of the Q1 Answer field but think it would be better if I could set the Q1 Answer field when the Q1 Question field changes, so I presume I will need to set this on some property of Q1 Question?
SO my question is 2 parts: How do I correctly write the If statement and what is the best way to do this - on Q1 answer or on Q1 Question?
Thanks for the help!
You may not need if for this. Insert a dropdown1 and set the Items of the dropdown1 with the List: Choices( List.'Q1 Question' )
Then in the textbox for the answer put: dropdown1.Selected.Value
If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.
Thanks @eka24 , I understand most of your answer but not really sure what to do here:
set the Items of the dropdown1 with the List: Choices( List.'Q1 Question' )
I am rather new to PowerApps to still trying to get to grips with everything - sorry if I ask annoying obvious things!
Check out these cool Power Apps & vote on your favorite!
Check out whats happening in Power Apps
FIll out a quick form to claim your community user group member badge today!
Features releasing from October 2020 through March 2021