Visibility rule using collection value

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 :confused: any pointers, thanks.

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.

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ā€ :man_shrugging:

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:

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?

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 :+1:

1 Like

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.

2 Likes

Hi @Kamalthanks for taking the time to reply :slight_smile:
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 :sweat_smile:
Screenshot 2020-11-01 at 11.15.32 Screenshot 2020-11-01 at 11.15.46

1 Like

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

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ā€™ :expressionless:

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

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.

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?

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 :+1: else impossible to easily determine each vendors usage.

Screenshot 2020-11-04 at 10.52.16

Hi @dasuksta,

Then I have no idea why itā€™s not working :slight_smile:

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

hi @Victor thanks for taking a look, much appreciated :slightly_smiling_face: :+1:

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 :innocent:

1 Like

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.

@pford I have tried re-setting the visibility, no joy! :confused:
But will try your trick of creating anew component - as these were copy nā€™ pasted :slightly_smiling_face: :+1:

1 Like

Ohhhh yeah copy/paste stuff gets funked up sometimes.

1 Like

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