Expression of ref column

Hello everyone

In my App I have a table called "Orders"

It contains a column called "Driver" of type REF

>> The "driver" column refs to a table called "Driver Ca"

>>> "Driver Ca" table contains a column called "driver" which stores the name of the driver and a column called "Email" which stores the driver email.

----------------

Now in the "Order" table I've added a new slice called "Delivery Ca" and I want to make a row filter condition where ....

if (driver) column in (order) table MATCHES (driver email) in (driver ca) table

then that row will be shown

 

I've tried with THISROW but it hasn't worked.

please any help

 

Solved Solved
0 14 315
1 ACCEPTED SOLUTION

@Izzat_Safrah 

@dbaum 

Thank you all, I've read some posts and finally I am able to solve it ๐Ÿ™‚

> Here is what I did:

โ–บIn "Driver ca" table I made Email column as a key.

โ–บ In slice " Delivery Ca" in table "Orders" I wrote this code to filter rows.

And(
[status]="Processing",
[Pickup Delivery]="Delivery",
USEREMAIL()=[Driver].[Email]
)

and now each driver can only see his/her own rows.

 

Thank you all indeed

 

View solution in original post

14 REPLIES 14


@aminsaleh wrote:

if (driver) column in (order) table MATCHES (driver email) in (driver ca) table


Here's the row filter condition for what you literally said you need:

IN([Driver], Driver Ca[Email])

However, it sounds like you might actually need something else--based on your explanation,  one of the following would be true, but likely there's instead something I'm misunderstanding

  • The values in the Order table's Driver column would always be in the Driver Ca table's Email column--i.e., the filter would always return all rows.
  • The Driver ca table has two redundant columns with each driver's email.

If you need something else, I suggest share screenshots of each table's columns from the app editor.

Hello @dbaum  and thank you for your help

It did not solve my question

Let me elaborate a bit more. Kindly see below image:

Q2.jpg

You see the main table is "Orders" and it contains a column called "Driver"
and that column of type ref and it refs to another table called "driver ca" that stores driver name and email.

In the order table I created a slice called delivery and I want to make a Row filter condition delivery for specific driver only.

 

@Steve 


@aminsaleh wrote:

see below image


Your illustration confirms my understanding of your original post's outline of your table and column structure. So, that was clear.


@aminsaleh wrote:

 

if (driver) column in (order) table MATCHES (driver email) in (driver ca) table


This is probably what remains unclear. I think that the row filter expression I gave you matches this requirement, although we both noted that it's probably not what you actually need.

Maybe you want the slice filtered to the driver whose email matches the current user's email?

  • A good way to accomplish that would be to use the Driver CA table's Email column as the table's key. Then, you can easily filter any table that references the Driver CA table by the current user's email. See  SUMMARY TIP: User permissions, roles, and settings - Google Cloud Community  for an overview of customizing an app for each user.
  • Given your current data structure, here's an alternate approach:
    • Create a slice for the Driver CA table that contains only the current user's row.
    • In your slice for the Orders table, use the following filter condition: IN([Driver], Driver CA Slice[Driver]).

@dbaum 

First off thank you very much for your kind support but I have tried everything and nothing helped.

I do not know what info I can share more. If I can give you an access that will be really great.

 

>> I've tried by making the column email in Driver ca table a unique key. then by making driver as a key and nothing helped in both cases.

>> Now driver ca table is as below:

1.jpg

 

>> Driver ca slice as below:

2.jpg

>> Slice "delivery ca" in the main orders table is as below:

3.jpg

>> Slice deliver ca show if condition is this:

4.jpg

 

In fact what I want to accomplish is  simply to allow each driver to only see his own rows. each driver will have to login via Gmail to use the App by the way which is intuitive. 

 

**Example:

If I have a driver called Mike and a driver called Moe

If mike logs in to the app and goes to delivery tab, he will only see rows that contains himself as a driver. and likewise for Moe.

 

Thanks indeed

 

 

ูAdd comma

A521-4_1.jpg


@dbaum wrote:

A good way to accomplish that would be to use the Driver CA table's Email column as the table's key. Then, you can easily filter any table that references the Driver CA table by the current user's email.


This is still the most straightforward approach. For example, your current data structure requires every driver to have a unique name, which isn't dependable.


@dbaum wrote:

Given your current data structure, here's an alternate approach:

  • Create a slice for the Driver CA table that contains only the current user's row.

Your screenshot for this slice shows that the slice has no row filter. Enter an expression that filters the table to only the current user--e.g., [Email] = USEREMAIL()

@dbaum 

I have tried everything you said

I do not want to waste your time. I've sent you almost everything.

When I say I've tried everything I laterally mean everything.

I tried this [Email] = USEREMAIL() and tried many options. NOTHING helped.

BEST SOLUTION IS: I can add you on my app as an admin and you see it clearly from inside.

otherwise I will be just wasting your valuable time. 

 

Untitled.jpg


@aminsaleh wrote:

I tried 

dbaum_0-1684758442675.png

This expression doesn't make sense.

  1. IN([Driver], Driver ca Slice[Email]) evaluates whether a row's value in the Driver column appears in the Driver ca Slice's Email column. Unless the Driver column contains email values, it will always return false.
  2. USEREMAIL() returns the current user's email. Regardless of whether #1 returns true or false, neither of those values will never equal the user's email.

Is there any solution to work my way around it @dbaum 

@Izzat_Safrah 

@dbaum 

It is not a comma problem, I just sent you screenshot in my last comment before adding the comma. I know about that. that is simple intuitive.

But still I could not solve the main issue

 

comma.jpg

@dbaum 

I've just sent you a PM, kindly check it

In slice try this formula.

AND(

[Driver]=LOOKUP(USERMAIL(),"Driver ca","Email","Driver"),

[Status]="Processing",

[Pickup Delivery]="Delivery"

)

@Izzat_Safrah 

Thank you but did not help

@Izzat_Safrah 

@dbaum 

Thank you all, I've read some posts and finally I am able to solve it ๐Ÿ™‚

> Here is what I did:

โ–บIn "Driver ca" table I made Email column as a key.

โ–บ In slice " Delivery Ca" in table "Orders" I wrote this code to filter rows.

And(
[status]="Processing",
[Pickup Delivery]="Delivery",
USEREMAIL()=[Driver].[Email]
)

and now each driver can only see his/her own rows.

 

Thank you all indeed

 

Top Labels in this Space