Hi all! In the "Behaviour" section of the Ap...

expressions
(Malaka Jayawardene) #1

Hi all!

In the “Behaviour” section of the AppSheet, we have system generated actions like “Edit”, “Add”, “Delete”. The ‘Behaviour’ section of each of these actions is supposed to allow a condition based appearance of these actions. However, they don’t work for me as intended.

I’ll give an example.

There’s a “New” button that is shown at the end of each inline view of a child table when I’m in the parent table’s detail view. This “New” button disappears when the system generated action ‘Add’ pertaining to the child table is set to “Do not display” from the ‘prominence’ option in the ‘Appearance’ section. But if I try to get it to disappear by writing an expression through the ‘Only if this condition is true’ of the ‘Behaviour’ section, it doesn’t work. I wanted the “New” button to disappear if a column called ‘Follow up_SUM’ returns a value of ‘9’, but show only if the value is 0,1,3,4,5,6,8. But this doesn’t work, and the “New” button is still shown when the value is ‘9’. The weird thing is, if I go and take off the value ‘0’ from the show only if expression (which means, if the ‘Follow up_SUM’ column returns the value of ‘0’, the ‘New’ button should not be shown), the “New” button disappears as intended. But that is not what I want, I want the “New” button to disappear if the value returned is ‘9’. I can’t get it to work though.

Any reason for this behaviour?

Thanks.

(Reza Raoofi) #2

What was the exact expression you entered in the show condition? Also what is the column type for Follow up_SUM?

(Steven Coile) #3

What expression are you using for Only if this condition is true?

(Steven Coile) #4

What if you replace your existing Only if this condition is true expression with:

[Followup_Ref].[Follow up_SUM] <> 9

or:

IN([Followup_Ref].[Follow up_SUM], LIST(0, 1, 3, 5, 6, 8))

I’m actually kinda surprised that you’ve gotten any expression to work that references the current row.

(Malaka Jayawardene) #5

+Steve Coile Thank you for the reply. I tried both. The former didn’t have any impact at all. The latter while removed the “New” button from the Inline view (in a previous record where all 3 inputs have been entered by me), it also removed the ability to access the “Follow up” referenced virtual column from the Personal Details Form view at the beginning of a new data input. This is exactly my problem. I’ve added 2 photos below for your kind perusal.

(Malaka Jayawardene) #6
(Malaka Jayawardene) #7
(Steven Coile) #8

I’m afraid I’m at a loss. The behavior you’re experiencing it’s odd, but I’m not convinced it’s a bug in AppSheet. The setup you’ve described is complex; there’s nothing more I can offer without a great deal more understanding of your app.

(Malaka Jayawardene) #9

+Steve Coile Thanks for the reply. How to make you more understand my app? Can I give you a copy of it and transfer the authorship to your email? Is it possible to do that in AppSheet?

(Steven Coile) #10

@Malaka_Jayawardene, that is possible, yes. You can copy the app with Manage > Author > Copy App, then from the copy, you can share the copy with me from Users > Users > SHARE YOUR APP WITH, being sure to set Add as co-authors? to ON. This will share the copy with me and allow me to see and change the copy. You will retain full access of the copy and can revoke my access at any time.

(Malaka Jayawardene) #11

@RezaRaoofi ‘Follow up_SUM’ is a number type virtual column that sums up the values in a number type virtual column called ‘Follow up counter’.

In my app, “Personal Details” is the parent table and, “Follow up” table is one of several child tables referenced to the parent table.

“Follow up” table has an enum type column to select 3 options (Clinic review, Recurrence, Death). I made it in such a way that the user can only select one from each of these options per patient (that means, the “Follow up” table which is a child table to the “Personal Details” parent table would only record 1 clinic review, 1 recurrence and 1 death per patient. Selecting the clinic review opens up another child table “Clinic Reviews” which records multiple clinic records under that.). If the user selects clinic review from the Enum type column in the “Follow up” table, it would return a value of 1 in the “Follow up counter” virtual column, and if the user selects ‘Recurrence’, it would return a value of 3, and if ‘Death’, a value of 5. Since only 1 of each can be selected, the cumulative values can be either 0, 1, 3, 4, 6, 8, and 9 and it is the ‘Follow up_SUM’ virtual column in the personal details parent table that sums these values up by the expression SUM(SELECT(Follow up[Follow up counter],[Followup_Ref]=[_THISROW],TRUE)).

Since the “Follow up” table is a child table to the “Personal Details” parent table (referred by ‘Followup_Ref’ ref type column), the expression [Followup_Ref].[Follow up_SUM] brings the ‘Follow up_SUM’ virtual column’s value back to the “Follow up” table so that I can use it in the part of the Behaviour section of AppSheet. I wanted the “New” button to disappear in the inline view of the “Follow up” table once user uses up all 3 options, so that the user won’t be presented with a “New” button anymore. To do that, the “New” button should not appear once the ‘Follow up_SUM’ is equal to “9” (1+3+5 = 9), and the “New” button should appear if ‘Follow up_SUM’ appears to be 0, 1, 3, 5, 6, or 8. So I wrote on the section the following: OR([Followup_Ref].[Follow up_SUM]=0,[Followup_Ref].[Follow up_SUM]=1, [Followup_Ref].[Follow up_SUM]=3, [Followup_Ref].[Follow up_SUM]=5, [Followup_Ref].[Follow up_SUM]=6, [Followup_Ref].[Follow up_SUM]=8)

Thanks.