Show_If expressions to limit "New" Button in child records(virtual colum)

Hi, I am making an application in which I want to allow only one data to be loaded per referenced row. That is, I need to hide the “Add” button when there is already a row saved.
To do this, I create the slices for each “related” column, set them to “READ ONLY”, then go to Data–> Columns and create the virtual columns with their respective “READ ONLY SLICES” as source and use the expression COUNT([Related Column)=0/1 in the “Show_IF” section to toggle between both columns to get the effect that the “Add” button disappears when adding an entry.

I’ve done this with other apps…and it worked fine.

The problem is that I’m trying to replicate it after having success with other apps, and I can’t get the expected result.
What happens is that every condition that I enter in “SHOW_IF” is totally ignored by appsheet and it keeps showing the column that has the expression to hide itself and the “Add” or “new” button.

I attach screenshots.

This is the Slice

Here the ref column and the slice Read_only


and this is the result:

WTF

Looks like the Read Only slice works good, but the “Related Column” didnt hide.

The show_if expression is

COUNT([Related Column]) = 0

when no entry is recorded in child table “Add” button must show itself, but if one entry is recorded the related column must hide itself, and the slice show instead.

But this didnt work this time.

Am I doing something wrong? is this a bug? I have checked this same procedure in other apps I have done and it works correctly.

Should I make a ticket to support?

Any help would be welcome.

Hi @Aplicaciones_Huinoil

What happens if you set no condition at all on show_if expression ?
You should have your two “related” columns, one with Add/View and the other with only View.
That may help going step by step ?
Let us know

@Aurelien thanks for reply,

If I don’t set any condition in the SHOW_IF, I just check and uncheck the box, it appears and disappears as checked/unchecked but any condition I add to the show_IF (tested with COUNT/ISBLANK/ISNOTBLANK/NOT(COUNT)) is completely ignored and works as if I didn’t set any condition, resulting in the 2 virtual columns (SLICE and Related Column) being shown.

But, the slice, working correctly, is hidden when there is no data entered, and is shown when there is already a data entered, hiding the “Add” button.

The problem is with the “Related Column” column, which is still shown despite the condition of hiding.

I also tried to create slices of the “Related Columns” and set condition to see if this changed something, but either creating new virtual columns that copy the “Related Columns” or using slices, the SHOW_IF still does not respond, it only works with the READ_ONLY slices, with the “Add_Only” slices it does not pay attention to the SHOW_IF condition, so it sounds a bit like an error or bug, or that I’m doing something wrong and I have not discovered it yet. But I’m still searching, as I mentioned, I have other apps configured in this way that do work.

What happens in the expression editor, when you click on the Test button for this expression ?
COUNT([Related Column])=0

Does the output match your expectation ?

I would suggest using ISBLANK() instead of COUNT, if that changes something.

Edit : if the condition on the show_if for related slice works, did you try NOT(yourConditionExpression) for the other one ?

Hey @Aurelien
Basically @Aplicaciones_Huinoil is trying to make a one-to-one relationship which should be similar in complexity as my case where I need diferent forms/inline views.
I strongly think this is a bug from the platform that sometimes it just doesn’t work as you configure it with the slices as the table source for inline views.
This made me think that:

Which is something I can confirm.

@Steve sorry to bother you but, have you seend this? Somethimes the VC type List ignores the fact that it should be pointing to a slice (and it’s actions and permissions) and instead it points to the table

2 Likes

@Aurelien I tried this

"I would suggest using ISBLANK() instead of COUNT, if that changes something.

Edit : if the condition on the show_if for related slice works, did you try NOT(yourConditionExpression) for the other one ?"

Didnt work, here the screeshots:



and here is the result:

Screenshot_4
as you can see didnt hide, the [PR] Column but the RO(Read only) works fine.

when i press “test” in the expression box, gives me the following results:

In this screen i tried to change [_This] and set [PR] (Related column) but i the result is always the same, the Show_IF function didnt work properly with the related column.

i cant understand what the issue is.

Any help would be welcome.

1 Like

Going all the way back to what you described in your original post, this expression:

image

should instead be:

COUNT([Related Puntos Revisiados]) <> 1

Note carefully the column name (Related Puntos Revisiados) and operator (<>).

@Steve

Exactly, the original name was “Related Blabla” but as I had the same problem, I tried to change the name to [PR] because in other apps where the SHOW_IF works, I had changed the name to [PR]. Obviously changing the name from “Related” to “Custom Name” ([PR] in this case) didn’t solve the problem.

And i tried all kind of operators and other expressions like ISBLANK, ISNOTBLANK, NOT…

1 Like

Well that’s super confusing. You shouldn’t change the problem even as we’re trying to help you. I don’t know how everything is setup now, and I’m not going to wade through the thread to figure it out.

Your original problem was that your Show_If expression was wrong.

Hi @Aplicaciones_Huinoil

This is weird, some very subtle detail must have gone through our understanding.
As @SkrOYC suggested, may be a bug too.

I suggest you leave a request to the support team, in the “how to question” section.
https://www.appsheet.com/Support/Contact

1 Like

I think you should check out this link

2 Likes

I have the fix to this bug, delete your broken app and build up a New one… All the time I use appsheet this is the 3rd that I have this kind of bugs.

In all the fix was delete and remake the app.

For everyone if you notice that you appsheet or some function didnt work, appsheet get bugged and you must delete and rebuild your app to fix this.

Actually I’m suspecting I need to do the same thing. But I would rather delete the columns instead of the whole app

I tried delete columns and didnt work, but I wish you gl to fix it soon. At least for me, only way is remake a New app, tyvm for your help& time.