Filter by the email address and obtain the barcode at the last row

Hi, I have a question on creating an expression. The below table is called “Product”.
3X_c_1_c1ae332e44a13c240f091de1846274539ec69c14.png
I have another view created from another table that require the field “GTIN”. Under the “GTIN” field, I want to create an expression that read back to the “Product” table. What I want is to filter by USEREMAIL() and select the GTIN that is the most recent added. For example, if I login in using mary@gmail.com, the GTIN value that I want to obtain will be “9556108261009”.
For example, if I login in using edmund@gmail.com, the GTIN value that I want to obtain will be “931048834115”.
In short, I would like to select the latest GTIN value based solely on the useremail login.
I have created the expression but it does not work.


Can anyone advise me on how I can form my expression to achieve what I want?

Solved Solved
0 12 294
1 ACCEPTED SOLUTION

Steve
Platinum 4
Platinum 4

In what way doesn’t it work? No result? Result for a different user? Not the latest GTIN for the current user?

For testing, you need to login to the app as the test user. It may not be sufficient to use Preview As in the app emulator of the app editor.

View solution in original post

12 REPLIES 12

Hello @lala_land, how about this expression?

INDEX(SELECT(Product[GTIN],USEREMAIL()=[_THISROW].[Useremail]),COUNT(SELECT(Product[Useremail],USEREMAIL()=[_THISROW].[Useremail]))

Thanks @Rafael_ANEIC-PY. The expression does not seem to work. It is still reading from the last row of the “Product” table.



Do you still have any idea at the moment of how to achieve that?

Well, yeah, you said you wanted the “latest”, and spreadsheets get new entries as new rows, so what’s at the bottom is the newest, and what is at the top is the oldest.

If you want the oldest one you can use this expression:

INDEX(SELECT(Product[GTIN],USEREMAIL()=[_THISROW].[Useremail]),1)

Hi, what I need to show the latest GTIN which is accessed by the useremail.
For example, I am login with useremail edmund@gmail.com, the GTIN should be 9310488341115. I tried the formula you provided me, when I am login with useremail edmund@gmail.com, it is not giving me the correct GTIN. It gives the GTIN 9556108261009 which was by mary@gmail.com not by edmund@gmail.com.
3X_c_1_c1ae332e44a13c240f091de1846274539ec69c14.png
Can you assist me with the correct expression to show the correct GTIN?

Thanks for the reference link. I have tried many times and I still couldnt get what I want to work. I have tried the following but it is still reading from the last row of the table instead of reading the latest row based on the useremail login.


Are you able to provide some hints of how I can reform my expression?

Did not help that mary@.com has the same GTIN for the first and last entries on that screenshot lol

And your original post does say

Hi @lala_land
I havent followed this closely but maybe you need to add in a VC to find your user and then find the users last entry.

Hmm… what do you mean by VC to find your user? I don’t quite understand. Can you elaborate more ?

Steve
Platinum 4
Platinum 4

In what way doesn’t it work? No result? Result for a different user? Not the latest GTIN for the current user?

For testing, you need to login to the app as the test user. It may not be sufficient to use Preview As in the app emulator of the app editor.

It does not work as in it is not the latest GTIN for the current user.
3X_c_1_c1ae332e44a13c240f091de1846274539ec69c14.png
For example, I login as edmund@gmail.com, it will still get the GTIN “9556108261009” instead of “9310488341115” which should be the case if it works.
Yes, I have been trying Preview as in the app simulator. Maybe I will try on the device instead. Thanks for the advice.

Thanks Steve. I have tried to login in with different email address using the AppSheet application on my device. And it works. From the app simulator, it is not sufficient to use the Preview As like what you have mentioned.

Top Labels in this Space