# Visibility rule using collection value

**URL:** <https://forum.adalo.com/t/visibility-rule-using-collection-value/5480>\
**Category:** Get Help\
**Created:** [October 30, 2020, 1:43pm UTC](https://forum.adalo.com/t/visibility-rule-using-collection-value/5480 "2020-10-30T13:43:02Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![dasuksta](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.adalo.com/dasuksta/32/3402_2.png) [@dasuksta](https://forum.adalo.com/u/dasuksta)\
**Post date:** [October 30, 2020, 1:43pm UTC](https://forum.adalo.com/t/visibility-rule-using-collection-value/5480/1 "2020-10-30T13:43:02Z")

</div>

Hi Guys - kinda bamboozled here!!  
I have an object that I want to show if value of X is greater than Y where the two values are stored in the same collection (as Storage Used & Quota Waring as numbers) but thats not working!

The rule works if I enter the second value manually 😕 any pointers, thanks.

---

<div class="post-metadata">

**Author:** ![Kamal](https://avatars.discourse-cdn.com/v4/letter/k/a698b9/32.png) [@Kamal](https://forum.adalo.com/u/Kamal)\
**Post date:** [October 31, 2020, 3:40am UTC](https://forum.adalo.com/t/visibility-rule-using-collection-value/5480/2 "2020-10-31T03:40:04Z")

</div>

I tried it like this. And it works.

1. Collection with 2 number fields/properties named Storage Used & Quota Warning.
2. Add a Custom list.
3. Use conditional visibility option for a label/button or any component of that custom list liek shown in the screenshot.

I hope this is what you were aiming at.

Regards.

 ![Experiment conditional visibility](https://us1.discourse-cdn.com/flex020/uploads/adalo/original/2X/d/db638052d0409ba6b361a41c45342f74b9ebb819.png)

---

<div class="post-metadata">

**Author:** ![dasuksta](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.adalo.com/dasuksta/32/3402_2.png) [@dasuksta](https://forum.adalo.com/u/dasuksta)\
**Post date:** [October 31, 2020, 11:52am UTC](https://forum.adalo.com/t/visibility-rule-using-collection-value/5480/3 "2020-10-31T11:52:25Z")

</div>

Hi @Kamal thanks for the reply…  
Apposed to a list item I am wanting to show the user a message (see attached) and whenever I try to map the Greater Than value via the collection - just don’t wanna work!  
The logic seems pretty rudimentary to me, but just can’t get it to function without adding a “Hard Value” 🤷‍♂️

 ![Screenshot 2020-10-31 at 11.48.31](https://us1.discourse-cdn.com/flex020/uploads/adalo/original/2X/b/b4d13d1e8fb0113ebb5bbe81b81bf802a8d46ae4.png)

---

<div class="post-metadata">

**Author:** ![Victor](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.adalo.com/victor/32/2054_2.png) [@Victor](https://forum.adalo.com/u/Victor)\
**Post date:** [October 31, 2020, 12:15pm UTC](https://forum.adalo.com/t/visibility-rule-using-collection-value/5480/4 "2020-10-31T12:15:18Z")

</div>

Hi @dasuksta,

That looks weird… I tried to re-create something similar based on my experiments app. Used a list of Cinemas, added Capacity and Actual properties (imagine this is nb of seats / bookings). The goal was to display warning sign if Actual \> Capacity.  
It worked:

 ![Screenshot 2020-10-31 at 15.12.47](https://us1.discourse-cdn.com/flex020/uploads/adalo/original/2X/c/cdbd2b821a2b36f9c0e8de06debda5e59ea6ee59.png) ![Screenshot 2020-10-31 at 15.13.17](https://us1.discourse-cdn.com/flex020/uploads/adalo/original/2X/0/099abaa5a878fffc063afdb3f1a30279fe2cec5e.png)

---

<div class="post-metadata">

**Author:** ![Victor](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.adalo.com/victor/32/2054_2.png) [@Victor](https://forum.adalo.com/u/Victor)\
**Post date:** [October 31, 2020, 12:21pm UTC](https://forum.adalo.com/t/visibility-rule-using-collection-value/5480/5 "2020-10-31T12:21:48Z")

</div>

As a crazy idea: may be you could try adding some test element (button/icon/etc) and try to change visibility of it?

Also, another idea: did you check how do you compare the numbers? I.e. in your case “warning” should be shown when storage used is over 80%, so both properties should store %% of storage used. May be you compare %% with absolute number?

---

<div class="post-metadata">

**Author:** ![dasuksta](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.adalo.com/dasuksta/32/3402_2.png) [@dasuksta](https://forum.adalo.com/u/dasuksta)\
**Post date:** [October 31, 2020, 2:33pm UTC](https://forum.adalo.com/t/visibility-rule-using-collection-value/5480/6 "2020-10-31T14:33:47Z")

</div>

Hi @Victor thanks for the update - will try your suggestions but for reference the values are absolute numbers - I am just appending the % as text to the end in the UI… My formula works out the used storage and I round it down to a simple number = ROUND((USEDBYTES / ALLOWANCEBYTES) x 100).

But will test using another UI item - like an Icon 👍

---

<div class="post-metadata">

**Author:** ![Kamal](https://avatars.discourse-cdn.com/v4/letter/k/a698b9/32.png) [@Kamal](https://forum.adalo.com/u/Kamal)\
**Post date:** [November 1, 2020, 3:22am UTC](https://forum.adalo.com/t/visibility-rule-using-collection-value/5480/7 "2020-11-01T03:22:38Z")

</div>

Hi @dasuksta,

I think its something to do with

1. Relationships of your collections and the properties.
2. The way you reach that screen which decides what data is pulled (to be available for use) in that screen.

Anyhow, I tried something simpler and it worked

1. In the users collection, added 2 number properties - “Storage used” and “Quota Warning”.
2. Then, the conditional visibility works on any text label or button etc. For that particular logged in user, if used storage is greater than set warning, the warnign label is seen.

I am sure you would need some relationships from anotehr collection which pulls the data of storage used, that woudl require some trial and error testing.

Alternatively, you could just display that users current storage used and display on his/her profile the total usage and give different colours if it falls above the quota warning.

Let us know, hwo you solve.

---

<div class="post-metadata">

**Author:** ![dasuksta](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.adalo.com/dasuksta/32/3402_2.png) [@dasuksta](https://forum.adalo.com/u/dasuksta)\
**Post date:** [November 1, 2020, 11:18am UTC](https://forum.adalo.com/t/visibility-rule-using-collection-value/5480/8 "2020-11-01T11:18:28Z")

</div>

Hi @Kamalthanks for taking the time to reply 🙂  
On the collection - then user click on to view their “Storage” I have an action that counts and calculates the usage of that user (based on the files owned by them) and then updates the Storage Collection. I have check this is working - and the Files count is updating the Storage collection but when using the formula as described in the UI… not so!  
For now I have hard coded the values, but was hoping to to have this more dynamic so it could be managed on a per-user basis, but will re-check my relationships… As always I’ve mot likely missed something simple 😅  
 ![Screenshot 2020-11-01 at 11.15.32](https://us1.discourse-cdn.com/flex020/uploads/adalo/original/2X/8/83cf450defd4554c6b546fb3f1511dbd3824c10e.png) ![Screenshot 2020-11-01 at 11.15.46](https://us1.discourse-cdn.com/flex020/uploads/adalo/original/2X/e/ee4b857889f41fe8443c0ff3dd244b8e45e788e2.png)

---

<div class="post-metadata">

**Author:** ![Victor](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.adalo.com/victor/32/2054_2.png) [@Victor](https://forum.adalo.com/u/Victor)\
**Post date:** [November 2, 2020, 10:43am UTC](https://forum.adalo.com/t/visibility-rule-using-collection-value/5480/9 "2020-11-02T10:43:40Z")

</div>

Hi @dasuksta,

Tried with formula in my app - worked for me.  
That’s mysterious… could you share the part when you set up the formula? May be via short video?

Best,  
Victor

---

<div class="post-metadata">

**Author:** ![dasuksta](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.adalo.com/dasuksta/32/3402_2.png) [@dasuksta](https://forum.adalo.com/u/dasuksta)\
**Post date:** [November 3, 2020, 10:14am UTC](https://forum.adalo.com/t/visibility-rule-using-collection-value/5480/10 "2020-11-03T10:14:11Z")

</div>

Hi @Victor  
Thanks for looking at this with me, appreciate your time… sorry for the late reply, yesterday I was jammed with real world issues like "accounts’ 😑

I have uploaded an explanation video (3:36 mins) not too long 😅

[![](https://us1.discourse-cdn.com/flex020/uploads/adalo/original/2X/3/399f22832c1e6ebce2624aab85c2962c59b094a7.jpeg "Using Table value to show element 2020 11 03 at 09 57 05") ](https://www.youtube.com/watch?v=SHI3-z3XzCw)

Please take a look when you can, for now I have hard coded the values - but understanding where i’ve gone wrong will really help.

---

<div class="post-metadata">

**Author:** ![Victor](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.adalo.com/victor/32/2054_2.png) [@Victor](https://forum.adalo.com/u/Victor)\
**Post date:** [November 4, 2020, 10:48am UTC](https://forum.adalo.com/t/visibility-rule-using-collection-value/5480/11 "2020-11-04T10:48:46Z")

</div>

Hi @dasuksta,

Very interesting.  
And what’s inside the “Storage” table? You’re comparing that to sum of Quota Warning 1 -s, so what’s there?

Also, I assume you actually use “Storage” collection just for the clarity of DB structure, and you should never have more than 1 record for each Vendor there?

---

<div class="post-metadata">

**Author:** ![dasuksta](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.adalo.com/dasuksta/32/3402_2.png) [@dasuksta](https://forum.adalo.com/u/dasuksta)\
**Post date:** [November 4, 2020, 10:55am UTC](https://forum.adalo.com/t/visibility-rule-using-collection-value/5480/12 "2020-11-04T10:55:55Z")

</div>

Hey @Victor  
See attached the Storage collection - i’m keeping details of the allowance and used space in bytes.  
Yes in storage there is only one record for each Vendor 👍 else impossible to easily determine each vendors usage.

![Screenshot 2020-11-04 at 10.52.16](https://us1.discourse-cdn.com/flex020/uploads/adalo/original/2X/b/badaa69bb19d0ada23aff06febdddff4c53e73f2.png)

 ![Screenshot 2020-11-04 at 10.52.35](https://us1.discourse-cdn.com/flex020/uploads/adalo/original/2X/3/3efbedac9bdcad7f27f7295570986ba005b0fce9.png) ![Screenshot 2020-11-04 at 10.52.50](https://us1.discourse-cdn.com/flex020/uploads/adalo/original/2X/8/8cea53538f2e8638cc91e03e0d4119a1ba05fec9.png)

---

<div class="post-metadata">

**Author:** ![Victor](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.adalo.com/victor/32/2054_2.png) [@Victor](https://forum.adalo.com/u/Victor)\
**Post date:** [November 4, 2020, 12:17pm UTC](https://forum.adalo.com/t/visibility-rule-using-collection-value/5480/13 "2020-11-04T12:17:26Z")

</div>

Hi @dasuksta,

Then I have no idea why it’s not working 🙂

I suspect something though; sometimes when I used the functions like “Sum” in a long-long relationship (like yours), they didn’t work correctly for me, so I had to choose the other way.

As an experiment and out of curiosity, could you put a label representing this Sum of “Quota Warning 1”-s, and see what value will be displayed?

Also, the DB structure seems a bit overcomplicated, but I have to think a bit before suggesting smth.

Best,  
Victor

---

<div class="post-metadata">

**Author:** ![dasuksta](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.adalo.com/dasuksta/32/3402_2.png) [@dasuksta](https://forum.adalo.com/u/dasuksta)\
**Post date:** [November 4, 2020, 12:43pm UTC](https://forum.adalo.com/t/visibility-rule-using-collection-value/5480/14 "2020-11-04T12:43:12Z")

</div>

hi @Victor thanks for taking a look, much appreciated 🙂 👍

Ref the DB structure - the app is Multi user with Companies & Their own users… so just let the evolution of the thing dictate, but your feedback is helpful & I’ll take deeper look at the DB structure and see where i can tidy things up - thanks again 😇

---

<div class="post-metadata">

**Author:** ![pford](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.adalo.com/pford/32/4648_2.png) [@pford](https://forum.adalo.com/u/pford)\
**Post date:** [November 4, 2020, 2:07pm UTC](https://forum.adalo.com/t/visibility-rule-using-collection-value/5480/15 "2020-11-04T14:07:22Z")

</div>

Not sure if this has been tried yet, but could you try one (or both) of these?

1. Reset the visibility to Always visible, save it, then retry the sometimes condition formula you were using?

2. Delete the component and try setting it up again.

I’ve noticed sometimes the visibility gets hung up on past setups.

---

<div class="post-metadata">

**Author:** ![dasuksta](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.adalo.com/dasuksta/32/3402_2.png) [@dasuksta](https://forum.adalo.com/u/dasuksta)\
**Post date:** [November 4, 2020, 2:33pm UTC](https://forum.adalo.com/t/visibility-rule-using-collection-value/5480/16 "2020-11-04T14:33:10Z")

</div>

@pford I have tried re-setting the visibility, no joy! 😕  
But will try your trick of creating anew component - as these were copy n’ pasted 🙂 👍

---

<div class="post-metadata">

**Author:** ![pford](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.adalo.com/pford/32/4648_2.png) [@pford](https://forum.adalo.com/u/pford)\
**Post date:** [November 4, 2020, 2:36pm UTC](https://forum.adalo.com/t/visibility-rule-using-collection-value/5480/17 "2020-11-04T14:36:21Z")

</div>

Ohhhh yeah copy/paste stuff gets funked up sometimes.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.adalo.com/system/32/40401_2.png) [@system](https://forum.adalo.com/u/system)\
**Post date:** [November 14, 2020, 2:36pm UTC](https://forum.adalo.com/t/visibility-rule-using-collection-value/5480/18 "2020-11-14T14:36:22Z")

</div>

Closed on November 14, 2020, 2:36pm UTC

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
