I posted a question earlier, and someone helped me get more information, but their answer pointed me to a resource that I couldn't find the solution in.
The problem is that I want to reference a data card from my form that uses an OptionSetValue data type in order to choose DisplayMode:
If(RequestTypeValue.Selected.Value="Initial Request", DisplayMode.Disabled, DisplayMode.Edit)
But I get an error on the = operator that the values being compared in the formula aren't the same type. As I understand it, I am trying to compare a string to an optionset, which it won't allow.
Does anyone out there know how to reference an OptionSetValue data type later in a form?
Solved! Go to Solution.
I don't ever use CDS so that may be different. I really can't say.
All of my apps are either SharePoint or SQL.
I would think the fundementals are the same because I know they are between SharePoint and SQL but I really can't say for certain.
Since you did the label that pulls the value you may try to see if you can refer to it and say:
If(Label1.Text="Initial Entry", DisplayMode.Disabled, Edit)
But that shouldn't be necessary. I would try it just to see though.
selected on a different screen or the same and the same form you are trying to set the display mode for a different form?
So basically they can get in the form as an Edit but if they select "Intial Request" from a combo box in that form then you want the form to be disabled at that point? That is what your If statement seems to be saying.
Is that what you are wanting to do?
Yes, there are two types of request Initial and Supplemental, which can be selected from the Request Type optionset box. Then, later in the form, they can enter the Initial Cost and Supplemental Cost. There will always be an initial cost, because even for supplmental types, there was an initial cost in the past. But if they Request Type selected is Initial Request then there will be no need for the Supplemental Cost data card on the form, so it should be disabled. The way I have my formula set up, it is checking the Request Type optionset for a string, which doesn't work.
Okay...so you can't select something in the form and then disable the whole form or it won't save any of it (including that selection).
What you can do is disabled certain cards in the form off that selection. So take the same If statement you have and put it on the display mode of the cards that you want to be disabled for that selection. That will give you the same result but work. You can just copy and paste it onto each of the cards you want disabled when they select Intial and it will just make those cards locked down basically.
Just a side note I would also suggest is that you also put on the type that the OnChange that if you select Initial it resets the ones you don't want them to change at that point. That way if they selected a different type and selected a bunch of data and then go back and change it to 'Initial' it resets all that data that should not have anything in there.
I hope I didn't just make it confusing. Let me know if I did and I will try and explain better.
Sorry if I wasn't clear, but this is for setting the DisplayMode on a particular card in the form, in particular the card for Supplemental Cost. I want that card to disable when Initial Cost is selected in the drop down located on the Request Type card.
My formula is already set up on the supplemental cost data card.
The problem is that the OptionSetValue data type from the Initial Request drop down is unsupported for evaluation. So how do I work around this?
Okay...that makes more sense.
That should work...I use it all the time. Check on your combo box and make sure you have the "allow multiple selections" turned off. I want to say I had that be an issue for me before.
Let me know if that isn't it and we can work through a few other issues it could be but it CAN work so probably just something little.
Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.
Check out the winners of the recent 'Can You Solve These?' community challenge!
Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.
Featuring samples like Return to the Workplace and Emergency Response Applications
Features releasing from October 2020 through March 2021