I want to set the colour of my gallery row based on the value of the status field. The pseudo code of what I think should be in the Fill attribute of the gallery is;
If (Status.selectedvalue.text = "Inactive", Gray, White)
I can't figure out the syntax to properly reference the text of the selected value of the status field.
Thanks in advance for your assistance.
Solved! Go to Solution.
I found a solution. I don't know if it's the "right" way to solve the problem but it works. It feels like kind of a hack.
I added a label control to my gallery template and set it's visible property to false. I set it's text property to ThisItem.Status. I used this formula in the Fill property of the template If(lblStatus.Text = Text('Status (Regulatory Business Processes)'.Inactive), Gray, White)
A few clarification details. I'm using a Dataverse. The status column is a Choice data type with two values; "Active" and "Inactive".
@Drrickyp. I tried what you proposed. It results in an error. I've attached a screenshot. The error message says. "Incompatible types for comparison. These types can't be compared: Error, Text"
Hi,
For Dataverse: Status = 'Status (Accounts)'.Inactive
Where you read accounts should be the name of the table you are using.
I'm still not certain how to use this to set the fill colour value for the gallery. When I use this;
If('Status (Regulatory Business Processes)' = "Inactive", Gray, RGBA(0, 0, 0, 0))
I get an error that says; "Incompatible types for comparison. These types can't be compared: OptionSet(Status (Regulatory Business Processes)), Text."
I think I understand the error message - that is that, 'Status (Regulatory Business Processes)' is an OptionSet. What I need, for my formula to work, is to be able to get the actual value that was selected for the Status column for a given record in the gallery. 'Status (Regulatory Business Processes)'.Selected.Text does not work.
Try this:
In a gallery: If ( ThisItem.Status = 'Status (Regulatory Business Processes)'.Inactive, Red, Green)
@jcfDaniel I get two errors with this statement.
The first is related to the "ThisItem.Status" part. It says Invalid use of '.'. The second error is the same as previously reported.
I found a solution. I don't know if it's the "right" way to solve the problem but it works. It feels like kind of a hack.
I added a label control to my gallery template and set it's visible property to false. I set it's text property to ThisItem.Status. I used this formula in the Fill property of the template If(lblStatus.Text = Text('Status (Regulatory Business Processes)'.Inactive), Gray, White)
User | Count |
---|---|
119 | |
86 | |
83 | |
74 | |
69 |
User | Count |
---|---|
215 | |
179 | |
141 | |
109 | |
83 |