Hi guys, happy new year for everyone,
This time I have a question:
Im trying to โSHOW IFโ a view, if certain value match with the criteria, but that specific value is within a enum column โwhich I donโt know if can be possibleโ.
So, everything is going fine when I do a lookup like this:
Lookup(Useremail(), โtable_nameโ, โemail_fieldโ, โvalueโ) =โcriteriaโ
But what about if I donโt want to do it by the useremail (Because is not the key)?
I tried this but not success:
LOOKUP([_THISROW].[id_field], โtableโ, โid_fieldโ , โvalueโ)= โcriteriaโ
It says:
canโt find [_Thisrow]
and I have the next warning message:
This formula is not evaluated in the context of a row, so column values are not available.
Solved! Go to Solution.
Finally, I have made this worked with a Select from the tables, and then, just doing a lookup on the slice.
Just in case anyone needs to know how to do it.
On the table A:
SELECT( TableB[fieldsearched], [keyfrombothtables] = [_THISROW].[keyfrombothtables])
Then on the slice:
lookup(useremail(),tableC,โemailโ,โfieldsearchedโ) = lookup([_Thisrow].[fieldsearched],tableC,โkeyfrombothtablesโ,โfieldsearchedโ)
That current_user Tips & Tricks, didnโt work for me because its โpullsโ a value, no โGETโ a value, which is what I needed, but thanks anyways for try to help @Kirk_Masden
Hi! Happy new year!
I think the problem is that _THISROW doesnโt make sense as a condition to show a view because itโs not clear what row your are on. Also, I donโt think the fact that a column is of the enum type should prevent you from putting it in a โshow ifโ condition.
Iโm not sure exactly what LOOKUP() expression to suggest but it should be something without [_Thisrow] in it.
The problem is if I do like you suggets without the โ_Thisrowโ is this:
This formula is not evaluated in the context of a row, so column values are not available.
Is weird, but im just trying to force to obtain an specific field instead of useremail(), which is automatically created by appsheet, like a function.
You wrote that this worked:
I havenโt used USEREMAIL() but the following article says that it will return just one value โ the e-mail address of the current user:
To make a LOOKUP() expression work as a show if condition for a view, you need to put a single value into that spot. If the value never changes you could just type that unchanging value directly in your LOOKUP() expression:
LOOKUP("Bob's Burgers", "Restaurants", "Name", "Phone")="382-9663"
The idea for this โBobโs Burgersโ example comes from the following article:
You may also want to consider this:
Actually, though, now that Iโm taking another look at this โtipโ I see that it explains how to make a USEREMAIL() slice and then use INDEX() instead of LOOKUP(). But I can tell you that the basic idea isnโt dependent on the use of USEREMAIL(). I use this combination of a one-row slice (determined by another criterion) with INDEX() to look up a value in a single cell that changes from time to time. So, I know it can be implemented without relying on USEREMAIL().
By the way, this technique also has the advantage of being more efficient than LOOKUP().
Thanks for your time and response Kirk, Im gonna test it and come back with news.
Finally, I have made this worked with a Select from the tables, and then, just doing a lookup on the slice.
Just in case anyone needs to know how to do it.
On the table A:
SELECT( TableB[fieldsearched], [keyfrombothtables] = [_THISROW].[keyfrombothtables])
Then on the slice:
lookup(useremail(),tableC,โemailโ,โfieldsearchedโ) = lookup([_Thisrow].[fieldsearched],tableC,โkeyfrombothtablesโ,โfieldsearchedโ)
That current_user Tips & Tricks, didnโt work for me because its โpullsโ a value, no โGETโ a value, which is what I needed, but thanks anyways for try to help @Kirk_Masden
User | Count |
---|---|
15 | |
9 | |
9 | |
7 | |
3 |