If want to set the fill color of an 'rectangle1' to green, if another field 'Title' is empty.
I tryed this: If(Title="", Color,Green, Color.Red)
and this If(IsEmpty(Tiltle.text), Color.Green, Color.Red)
both not doing the job.
What can I do to set the color of de Rectangle, when the Title is empty.
Any help?
Solved! Go to Solution.
Thank you very much.
This does the job for me:
If(Len(ThisItem.Title)=0; Green; Red)
Hi @Maas
What you require is easily done, but the solution depends on specifics of your app.
Where is the rectangle? On the screen or in the template of a gallery?
What do you mean by "another field"? How do you choose which record of the data source, or is Title the name of a text box?
If Title really is a field, then what is the name of the data source containing this field?
Thanks
The Rectagle (Rectagle1) and the Title (Subtitle1) are in de Browsegallery1
BrowseGallery1:
Rectangle1 is left (black), Title is 'BIN'.
What I want is:
whentrhe Title (hereunder BIN) (Field: Subtitle1) is blank/empty, then set fill Rectangle1 to Green else to Red.
If(IsBlank(ThisItem.Subtitle1), Green, Red)
This will test only blank.
If you also want to test for both blank and empty string ("") [they are not the same] then you need this
If(Len(ThisItem.Subtitle1)=0, Green, Red)
Please let me know how you get on
hmm.. not yet 🙂 Red
Field I want to check is Title (Subtitle1) See, hereunder
If this field is empty.
Then I select the Rectangle1 and type in
Hi @Maas, we will get there.
Thanks for the screenshot, this makes it much clearer. The field name is Title and you have a text box called Subtitle1 somewhere which could be a gallery or a display form.
Hence you are right that the expression needs to be ThisItem.Title
Now, I can think of a few possible issues for you to explore:
1) You are not in an English locale, therefore you may need to use semi-colon ; instead of comma , in the above expressions
2) The names of colours may also not work, so try RGBA expressions , hence something like this:
If(Len(ThisItem.Subtitle1)=0; RGBA( 0; 128; 0; 1 ); RGBA( 255; 0; 0; 1 ))
3) If it is a form, then you may need Parent instead of ThisItem
If this does not work, then just try to set the colour without the If statement to see what happens. Please let me know which colour expression works for your locale.
Thanks.
Thank you very much.
This does the job for me:
If(Len(ThisItem.Title)=0; Green; Red)
@Meneghino wrote:If(IsBlank(ThisItem.Subtitle1), Green, Red)This will test only blank.
If you also want to test for both blank and empty string ("") [they are not the same] then you need this
If(Len(ThisItem.Subtitle1)=0, Green, Red)
Please let me know how you get on
How about:
If(IsBlank(Trim(ThisItem.Title)), Green, Red)
to check for both blank and empty string?
hi @flyte
Yes, your expression would work, but it would also be green for " " and any number of spaces. This may or may not be what is needed.
It also appears that IsBlank("") is true, so IsBlank returns true for zero-length strings also.
User | Count |
---|---|
254 | |
112 | |
92 | |
48 | |
38 |