How do I hide related items if the list is empty

I have a Table "Answers" and another table "Answer Scratchpads" that has a Ref to an answer. I have the "Related Answer Scratchpads" list in answers and I want it to be displayed to a user but only when the list is not empty. I don't want the related answer scratchpad list just taking up space when the list is empty. I believe the right way to fix this is a show_if condition. The expression I used in the  show_if expression was:

 

 

count([Related Answer Scratchpads])>0

 

 

This seems like a simple enough expression that expresses exactly what I want. But it is not hiding the "Related Answer Scratchpads" list from the view when the list is empty. 

Appreciate any guidance on what I may be missing.

Edit:

Adding some additional info.

Related Answer Scratchpads is what's added automatically. It is:

REF_ROWS("Answer Scratchpad", "Answer")

And for my goal I don't want this showing up:

Screen Shot 2022-06-30 at 10.15.36 AM.png

But this I do want to show up.

Screen Shot 2022-06-30 at 10.17.40 AM.png

Solved Solved
0 21 789
1 ACCEPTED SOLUTION

Figured out the solution. In UX options, in the forms view there is an option for making the show_if view universal. Once the option was checked the empty list disappeared.

Screen Shot 2022-07-05 at 11.52.15 PM.png

View solution in original post

21 REPLIES 21

Try

ISNOTBLANK([Related Answer Scratchpads])

Nopes. Didn't work either.

I can only surmise that your table actually does have some data in it?

Have you checked all the way down the sheet? If it's a Google sheet it usually starts with a 1000 rows per table...how many rows do you have? Is the header row on line 1? 

This is what shows up. And this is exactly what I want to not show up. Scratchpad entries is the display name for the Related Answer Scratchpads.

Screen Shot 2022-06-30 at 9.56.46 AM.png

Try ISNOTBLANK() instead?

Try to do a list dereference, instead of just the [related...] column?

No luck with:

 

isnotblank(index(Answers[Related Answer Scratchpads],1))

 

or with

 

isnotblank(Answers[Related Answer Scratchpads])

 

Is that what you meant?

Edit:

Also tried

isnotblank(index([_THISROW].[Related Answer Scratchpads],1))

Steve
Platinum 4
Platinum 4

[Related Answer Scratchpads] contains a list of key column values that identify the rows containing the related Answer Scratchpads. Note that the list says nothing about the content of the related scratchpads. If a related scratchpad exists but has no content, the relation still exists, so [Related Answer Scratchpads] will not be empty. To check whether the scratchpad content is empty, you'll have to use a list dereference, as @Marc_Dillon suggested.

Build list dereferences - AppSheet Help

 

Sorry I'm confused. You mean if a key exists matching Answer Scratchpads that key will be stored in the list because of the REF_ROWS? I actually don't care about the content of the Answer Scratchpad itself. If the Answer Scratchpad exists but does not have any content I want it to still show so people can look at it and add to the scratchpad. But I don't want the empty list to show up to improve the user experience. Which I am unable to hide. 

Thank you for the added screenshots.

Based on everything you've shared, @scott_robinson's suggestion for the Show? expression should work:

ISNOTBLANK([Related Answer Scratchpads])

If not, you might instead try:

ISNOTBLANK([Related Answer Scratchpads] - LIST(""))

If neither of those work, please post a screenshot of the entire configuration screen of the Related Answer Scratchpads column.

Neither worked. Attaching the screenshots of the column.

Screencap 1 of columnScreencap 1 of columnScreencap 2 of columnScreencap 2 of column

This is the column order in the UX for Answer Details. I have Related Answer Scratchpads there since I do want to display them if I have values there. My understanding is that the show_if should override this.

Column display orderColumn display order

This is a detail view, right? Do you have Use Card Layout enabled? If so, try disabling it.

No don't have User Card Layout Enabled.

Screen Shot 2022-06-30 at 12.29.12 PM.pngScreen Shot 2022-06-30 at 12.29.51 PM.pngScreen Shot 2022-06-30 at 12.30.23 PM.png

Is the Answer column of the Answer Scratchpad table configured with Is a part of ON? If so, try disabling it.

It is configured with that. But in my experimentation I did try disabling and that still didn't work.

Very odd! Unfortunately, I have no other ideas for you. Please contact AppSheet Support for further help with this.

Thank you for trying. I'll consider it a badge of honor that I stumped @Steve  on my second question. Really appreciate your help on so many questions.

Please try below 

Please create a VC called say [CountDetails] in the table Answers with an expression something like 

COUNT([Related Answer Scratchpads])

In the column [Related Answer Scratchpads] 's Show_if, please enter 

[CountDetails]>0

However the above arrangement and your request itself is based on assumption that the records to the "Answer Scratchpads" table are added directly from another view and not from the referenced child view. This is so because when the [Related Answer Scratchpads] count is zero the referenced child table view itself will not be shown thereby not allowing any further adds to the table from the referenced view.

 

I tried adding the separate number, and I also tried adding a separate Y/N column. The Y/N column had the correct value but it still didn't  work when I used that. 

Your last comment is interesting. I had removed the direct access to the add action because I was having trouble figuring out how to set the Answer to be already filled out in the form view. But it worked as desired when I set up the "Is part of" and also modified the add to be an inline action. With that intention I guess the usability isn't too bad and I removed my custom action. 

I think I'll go with the different workflow although it would still be useful to know why the show_if isn't working as appropriate. 

Figured out the solution. In UX options, in the forms view there is an option for making the show_if view universal. Once the option was checked the empty list disappeared.

Screen Shot 2022-07-05 at 11.52.15 PM.png

Oh! Sorry for not suggesting that! I have had that setting enabled so long that I've forgotten it even exists! It really should be enabled by default for all apps, in my opinion.

No worries. Agreed on it being the default. I guess the documentation does mention it. One of those times I should have read the fine print.

Top Labels in this Space