How do I set a label AND display/hide a layout based on the length of a page list?
I have a page list LIST being populated by a web service call.
What I'm trying to achieve:
IF (LIST.length >= 5 && LIST.length <= 10) { set label LABEL to LIST.length + " years" AND show layout LAYOUT }
IF (LIST.length < 5) { hide layout LAYOUT }
A colleague showed me two ways to do this, both of which I find rather inelegant.
The first involves setting the "Defer load contents" and "Specify a pre-loading activity" settings on the layout and creating an activity to set a TEXT INPUT (that is being used as a label) to LIST.length + " years".
The second involves creating a dynamic layout and nesting new dynamic layouts inside containing labels with the values "1 year", "2 years", "3 years" ... "10 years" and setting the visibility of each of them with a WHEN rule based on LIST.length.
See what I mean? A seemingly simple requirement with pretty ugly solutions. Can anyone tell me if there is a proper or "nice" way to do this?
Thank you!
***Updated by moderator: Lochan to add Categories***