I just realize for visibility, glideapps is somewhat too simple for complex cases (or actually it’s just simple case really). So, I want to show an information but with these conditions:
Payment Send is Empty (not yet sending a payment)
AND
Level is 1 OR 2 OR 4.
At the moment, there is only one AND or OR in visibility, so my code will always change into either:
Payment Send AND Level == 1 AND Level == 2 AND Level == 4
or
Payment Send OR Level == 1 OR Level == 2 OR Level == 4
Which those are not correct at all.
I hope we can have true comparison here
I really love to see glideapps getting more recognition and implementing a true logical statement comparison will be one way to go.
You can do this by first creating an if-then-else column, and then use the if-then-else column as the filter. The logic for the if-then-else column will be:
If Payment Send is not empty, then blank
If Level equals 1, then true
If Level equals 2, then true
If Level equals 4, then true
Then your visibility condition will be "where if-then-else column is true"
I like the workarounds, and have used them (clever Jeff – had not thought that), but I agree that we need the ability for more complex comparisons. For example, some of my comparisons cross the lines between two tables, and the workarounds do not work in those cases. I’d have to go back over my logbook to see exactly which ones I abandoned as simply not doable, but they typically had to do with trying to make something work differently for an ADMIN user (flag in user record).
If an important flag exists in a second table you could use a relation + lookup to bring it into your source sheet. Then use the new lookup column in your ITE logic, component filter, etc…
I ran into a situation yesterday where a relation would not solve a problem, because I needed to look at a flag that was set, but not on the owner of the current record. You see, I am not using true row owners but simulating them because many users can share a record – but roles doesn’t help me here, either, because the user themselves can select what rows are available to them. Thus, no matter how I hammered on relations and lookups, I always ended back up at square one.
Believe me, I use relations all over and know how they work. They just don’t always answer the problem. My current user is an admin, but not the owner of the row, and I had several conditions that had to be met for a regular user to do something (so there was this AND, and and and), and I simply needed to add an OR if (logged in user) ADMIN is true. Seemingly simple enough, but without the ability to do complex logic without having to resold to relations, just isn’t always possible.
Maybe I need to see more information, but from what you explained, it seems that you could have two IF columns. One to check all of the AND conditions for a user and return true if they have access, and anoth IF column to check if that user IF value is true ELSE IF the signed in user is Admin. The combination of IF columns then act as an AND/OR.
Thanks all for the propose solution! Give me lots of insight for my future in Glide.
But I just realize how to use “is included in” like what Jeff said, and for me it is the most simplest solution, so I use this.
And upon finding solution for this problem, I just realize showing information for each level is still better whether user already send their payment or not. So, the conditional for “Payment Send” has been removed.
The code is now simpler, thanks to Jeff solution of using “is included”.
So it is now, “Show component when Level is included in 1,2,4”
I am just guessing it’s comma separated list. It works anyway!
Thanks!
Yes, and I do stuff like that, also. Sometimes it’s enough to make my head hurt!
Here are the columns I need to examine to see if a particular user should see a particular row:
I don’t think it matters. It’s just looking for matching text anywhere within the whole string of text. Seperating by commas is good practice though if you have double digit numbers or other cases where it could inadvertently find a match that you didn’t intend it to find.
If I recall, it’s ultimately your ‘Show In List’ column that’s a culminating of all the columns to the left, correct? I’m just thinking that you could have another IF column that checks if Show In List is true then true, else if Admin then true, else false.
Sorry, I know you didn’t explicitly bring this up and you were just talking about IF structure in general. I was just curious about your scenario. I can drop it now. But yes, formulating complex IF statements in glide isn’t always fun or easy.
Yes, and the “Show English” is what gets displayed in the list so they can toggle the viewable setting. That ability to toggle is what complicated it even more.
No need to drop it, I was just responding that generally, it would be neat if they implemented a regular expression column that spits out true or false. Or perhaps they have it and I’ve just missed that.
I haven’t messed with most of the plugins. I think there are some Regex related ones, but I’m not sure if they would work in this particular context. I have used the javascript plugin a handful of times though. If you really wanted to go all in, you could just pass your parameters into the javascript column, perform your IF logic there and return an ultimate true or false value.