Bug in system action in ref row

Hi,

I added in a condition in the Behavior/action/document(child table)/add “Only if this condition is true”
CONTAINS((SELECT(User[Access],[Email]=USEREMAIL())),ANY(SELECT(Main[Topic],[Topic]=[_THISROW].[Topic])))

Where [Access] is a EnumList.
Tested the Expression everything looks fine.
It was suppose to show a ADD button at the document ref row at the parent page if the user is assigned to the topic. Now I’m stuck…
Photo of suppose to be below
Suppose to be

Hi @BoonBoon

you can’t set a condition on the “add” button, as it is attached to the inline view.
you will have to display inline for another dataset, so you need to use a workaround.

I suggest you follow these steps:

  1. create a slice, with read_only option, based on your current children table. Let’s name it “children_slice_readOnly”
  2. add a virtual column “related children_slice_readOnly” to your parent table, and set this expression:
    REF_ROWS("children_slice_readOnly", "key_column")
    then set type List, Element Type: Ref, Referenced Table Name : children_slice_readOnly,
    It should be lookalike to your “related Children” expression
    REF_ROWS("children", "key_column")
  3. go into the show_if expression of these two columns:
    a) for the “related Children”, please set:
    CONTAINS((SELECT(User[Access],[Email]=USEREMAIL())),ANY(SELECT(Main[Topic],[Topic]=[_THISROW].[Topic])))
    b) for the “related childrens_slice_readOnly”, please set:
    NOT(CONTAINS((SELECT(User[Access],[Email]=USEREMAIL())),ANY(SELECT(Main[Topic],[Topic]=[_THISROW].[Topic]))))

that should do the job.

Edit: added some missing information about the type of the new virtual column

1 Like

Additional information:
I just made a sample app for educational purpose so that you can look under the hood.
You can find it in my portfolio:
https://www.appsheet.com/portfolio/1723746

If this is what you need:

4 Likes

Hi @Aurelien

It will work if I only compare to a constant value like ANY(SELECT(User[Access Level],[Email]=USEREMAIL())))>=3000, but it don’t work if I compare to a [_THISROW]. Anyway I’m out of option. Will give your method a try and update again.

Hi @Aurelien

Nice, this is what I mean. But I have quite a few child item under 1 parent page. Guess I have to do 1 slice for each of them just to hide the add button if user is not authorised to add item. If that’s the only workaround… Thanks for the suggestion.

Hi @BoonBoon

You don’t have too.
You slice is made of a row filter condition.
If this row filter condition takes the user into account in the expression, there is no need to make various slices, only one is enough.
You get what I mean ?

for reference:

2 Likes

Hi @Aurelien
What i mean is i have to do a slice for each of the following related child row. Unless i understand it wrongly. lol…
Child

Hi @BoonBoon

About this point, yes you are right.