Hi,
I've got a form that has fields that I want to user to enter, numerical values in a drop down (1-5). I've then setting a score field based on a sum of the two selectable field. Then based on the sum will define the level (Low, Medium or High).
For the score field I set the DataCardValues default value from the sum and then failing to set the rating field (if 0-4, Low. 5-10, Medium. 11-25, High).
Sum(DataCardValue422.Selected.Value * DataCardValue421.Selected.Value)
A quick test and I get an error message
If(
DataCardValue424 < 5, "Low","High"
)
In your formula, you are referring to the control...not to the value of the control.
I am not sure if you are stating the DataCardValue424 is a Label or a dropdown. If it is a dropdown, then the following formula is needed:
If(
DataCardValue424.Selected.Value < 5, "Low","High"
)
If it is a label, then the following:
If(
Value(DataCardValue424.Text) < 5, "Low","High"
)
You always need to refer to the property of the control that contains the value you want and not just to the control. Unfortunately, in the designer, sometimes just referring to the control works (erroneously), but in Play mode it will fail.
I hope this is helpful for you.
So I'd tried the value option previously and got an error, though I think the problem is that the field being set to Low or High would normally be a drop down list so I have to select the required value and not set a text value!
I'm actually a little confused on which control type you are setting and what you are getting it from.
If you are trying to set a dropdown that has "Low", "High" in it, then you would be setting the Default property of that dropdown with the previous formulas.
If you are setting a Text label, then the formula is fine in the Text property of the label.
If DataCardValue424 is a dropdown and .Selected.Value is not available, then what is the Items property of that control? .Value refers to a column in the items property of the control...so, if you are using a record source or a function that doesn't return Value tables, then you will not see that option...you would choose whichever is appropriate based on the Items property.
confusing others is quite a skill I have!
So I'm attempting to chose the Dropdown value and though the if statement validates correctly, I've also successfully tested on normal label which you see in the screen shot, there is still an error on the very simple formula (in this example value 2 is being validated as less than 5 so equals Low).
Couple questions
1) Is this a Combobox or a Dropdown? Please verify
2) What property are you trying to set on that control? Your image does not show the property, just the formula.
Hi,
This is actually a Combo box in a form which takes its list of options from a SP List choice field. I was wanting to set the Default based on the value of another field...in the end once its updating I'll set it as Display only.
So, first, a ComboBox is extreme for this purpose and only adds complexity. A dropdown would be a better choice.
The main reason is that to set Defaults on a ComboBox (which you can only do on the DefaultSelectedItems property), you need to provide a Record. So, your formula will never work as it is providing a Text value, not a record.
This all appears to be in a Form. So that would explain the combobox as it would choose that as a default control type...so...
If you want to keep the control type as a the combobox, then you need to set this formula in the DefaultSelectedItems property of the combobox to the following:
{
Value: If(DataCardValue424.Selected.Value < 5, "Low","High")
}
Note: this does not account for the ability to display the value of a record that has already been written (i.e. you're editing a record)
Despite all the wonderful support and help, I just couldn't get the fields to populate as I wanted (needed). With that I've moved away from workaround and changed the source (away from SP List Choices field) to be a simple text field that I now control from the p.App.
What I've learnt is start with the right data and structure to begin with and then building your app is easier without "workarounds".
Thanks (again).
Neil
Absolutely - the data structure is highly important to the simplicity of your App. Text and Number columns are your friends. Complex types are friends, but not your best friends.
User | Count |
---|---|
255 | |
106 | |
85 | |
51 | |
43 |