I need to set the DisplayMode property of a control based on if the first record in a collection is blank.
I can't use IsEmpty(CollectionName) because it's used in a gallery and always has a 'show saved' value in the first record, regardless if there is other data in that record. It's a pseudo InfoPath repeating table.
I don't get any syntax errors with this but it also doesn't change the DisplayMode Property.
If(IsBlank(First(Markets.Region)), Disabled)
Any suggestions for using the 'First' function along with If and IsBlank to help set visibility or displaymode?
Solved! Go to Solution.
First(Markets.Region)
This part should be
First(Markets).Region
Because you want the first record of the Marjets list and a check on the Region Property, right. Rest of the if() formula you can get from the other answers.
But be aware that with this solution ordering the gallery will break your logic.
Hope this helps.
If(First(Filter(Markets,IsBlank(Region), DisplayMode.Disabled,DisplayMode.Edit)
in the DisplayMode property of the control, assuming Markets is the name of the collection.
It doesn't like that. Since First is being specified, indicating the first record in the collection, is filter really needed?
If the collection is prefiltered and presorted, probably you are correct. Could you provide a bit more information regarding the context in which you are using this information?
You could try using a Lookup to return the blank record then test if a column within that record is blank.
If(
IsBlank(LookUp(Markets,IsBlank(Region),Region)),
DisplayMode.Disabled,
DisplayMode.Edit
)
First(Markets.Region)
This part should be
First(Markets).Region
Because you want the first record of the Marjets list and a check on the Region Property, right. Rest of the if() formula you can get from the other answers.
But be aware that with this solution ordering the gallery will break your logic.
Hope this helps.
Hi@JR-BejeweledOne,
Based on the issue you mentioned, you want to disable the button if the first record in your collection is blank.
Do you mean check if there is a field empty for the first record in your collection? You need to refer the first record to get the field value which is the goal to check if is blank.
On this premise, please modify your formula as below:
If(IsBlank(First(Markets).Region),DisplayMode.Disabled,DisplayMode.Edit)
Best Regards,
Qi Qiao
User | Count |
---|---|
157 | |
86 | |
68 | |
63 | |
61 |
User | Count |
---|---|
211 | |
152 | |
93 | |
81 | |
70 |