I have one Parent table (named "Urunler") whi...

expressions
(Yılmaz Kandiş) #1

I have one Parent table (named “Urunler”) which has key field as ‘idUrun’ and lots of other columns including ‘idUserEmail’ column. and Child table which has key value as ‘idDosya’ and has reference to parent via ‘idUrun’ column

How to make a Child Table ‘Read Only’ dependant on the values in ‘idUserEmail’ column in the Parent table?

I wrote an expression like this into Child table;

IF( ANY(SELECT(Urunler[idUserEmail], [idUrun]=[_THISROW].[idUrun],))=USEREMAIL(),

“ADDS_AND_UPDATES”, “READ_ONLY”)

but I receive error for above formula;

(Levent KULAÇOĞLU) #2

Bitmedi derdin, bitmedi​:joy::joy: SWITCH (USEREMAIL(),

"administrator@mydomain.com","ALL

_CHANGES",

“READ_ONLY”)

(Levent KULAÇOĞLU) #3

SWITCH( USEREMAIL(), ANY(SELECT(Urunler[idUserEmail], [idUrun]=[_THISROW].[idUrun])),

“ADDS_AND_UPDATES”, “READ_ONLY” )

(Aleksi Alkio) #4

The table access is not the correct way because you want to change the access by field value. One possibe option is the Editable_If field.

(Yılmaz Kandiş) #5

@Aleksi_Alkio Thanks! Editable_If works ok with my scenario but still want user not to be able to click on ‘New’.

(Levent KULAÇOĞLU) #6

Sometimes you want too much bro​:joy::blush:

(Aleksi Alkio) #7

If you create an additional REF_ROWS slice and that slice is Read_Only, you can use Show_If expression to show that inline table or not. If you have two separate inline views (one for normal table and one for the slice) you can have the feature you are looking for.

(Yılmaz Kandiş) #8

@Aleksi_Alkio I will try and inform after I enjoy beautiful ISTANBUL traffic jam

(Yılmaz Kandiş) #9

Hello sensei @Aleksi_Alkio it worked. Ref_Rows to a ‘Read Only’ slice and setting its Show_If helped me solve my problem. Thanks to you as well dear @Levent_KULACOGLU

(Aleksi Alkio) #10

You’re welcome

(Levent KULAÇOĞLU) #11

SWITCH( IN(USEREMAIL(),Urunler[idUserEmail], TRUE, “ADDS_AND_UPDATES”, “READ_ONLY” )

(Yılmaz Kandiş) #12

@Levent_KULACOGLU Selam Üstad, I got the same error for your formula; SWITCH( USEREMAIL(), ANY(SELECT(Urunler[idUserEmail], [idUrun]=[_THISROW].[idUrun])),

“ADDS_AND_UPDATES”, “READ_ONLY” ) … Error in expression ‘[_THISROW].[idUrun]’ : Unable to find column ‘_THISROW’, did you mean ‘Tür’?.. …

(Levent KULAÇOĞLU) #13

@Yilmaz_Kandis1 try the last one😉

(Yılmaz Kandiş) #14

@Levent_KULACOGLU

When I try the last one; SWITCH( IN(USEREMAIL(),Urunler[idUserEmail]), TRUE, “ADDS_AND_UPDATES”, “READ_ONLY” ) It doesn’t give error but it also doesn’t perform what I want.

I have ‘Files’ Child table for each ‘Urunler’. I want the user to add/update Files only if the Urunler is added by the user. In your formula, it compares UserEmail() to whole Urunler[idUserEmail]. If the user has only one record belong to him then for all records he will have Add_And_Updates. Isn’t it?

(Levent KULAÇOĞLU) #15

@Yilmaz_Kandis1 you can assign/revoke access on table level, not on row level

(Yılmaz Kandiş) #16

:pensive: This was the answer I was wishing not to get. Thanks bro!

(Levent KULAÇOĞLU) #17

@Yilmaz_Kandis1 you can achieve a result, provided you use a full slice of your table as per USEREMAIL(), then users can see only their own data. But let’s consult our “Master” @Aleksi_Alkio, may be he offers something more useful or operational than mine.

(Levent KULAÇOĞLU) #18

@Yilmaz_Kandis1 try this one also… SWITCH( USEREMAIL(), [MotherRecordRefColumnName].[ChildRecordEmailColumn], “ADDS_AND_UPDATES”, “READ_ONLY” )