Hi,
This thing is driving me crazy right now, and I really want to know if I’m doing something wrong or if it’s a bug.
Problem:
- I have an Image List Item that repeats based on a fixed list of objects. Each item in the list is a single key-value pair. (E.g.:
[{"a": "b"}, {"c": "d"}]
.) The properties of the Image List Item reference the currently repeated value as “me_eq”. - I have a data variable called “me_countryData” that contains an integer value for each key in the fixed list (e.g.,
{{"a": "3"}, {"c": "2"}}
– but slightly more complicated because it’s in Firebase schema format) - By referring to the data variable and to the key of the key-value pair that’s being currently repeated, I am able to set the visibility of my list item just fine. Specifically, this formula resolves correctly in a True/False value to set visibility:
INTEGER(LOOKUP(LOOKUP(data.me_countryData.fields.equipment.mapValue.fields, KEYS(repeated.me_eq)[0]), "integerValue")) > 0
- However, using the exact same variable and key reference, I am unable to set the list item’s secondary field or image. I’ll use the secondary field example because it’s simpler:
LOOKUP(LOOKUP(data.me_countryData.fields.equipment.mapValue.fields, KEYS(repeated.me_eq)[0]), "integerValue") + "/3 pcs"
results in "undefined/3 pcs."
I thought that maybe the issue was with Data Variables themselves, so I tried using a Page Variable with a simplified (name:integer) schema as an intermediary: LOOKUP(pageVars.me_eq, KEYS(repeated.me_eq)[0])+"/3 pcs"
. That failed too.
It appears that the problem is with any variable that is set or changed after the component itself loads. Even when I try to make the secondary field display something based on the simplest variable in the world (a text-only page variable that I set to “test” when the page loads), it will just show up as blank. App variables set by the global canvas via URL parameters when the app is initially opened work fine.
Workaround:
I was especially puzzled because essentially the exact same formula works beautifully in another part of the page.
These list items are themselves inside repeating containers, so the formula there looks like this:
LOOKUP(LOOKUP(repeated.currentCountry.fields.equipment.mapValue.fields, KEYS(repeated.eq)[0]), "integerValue")+"/3 pcs"
So, my workaround ended up being that I wrapped the misbehaving list in its own repeating container (a list of all “country” objects), limiting the container to a single item (the “country” object whose data I wanted to reference).
However it took me about an hour to figure out that this would solve the problem. Was there a better way to go about this? Is this a mistake I am making or is this an AppGyver bug?
I found a help topic about a similar issue, but @Harri_Sarsa’s response at the time seemed to indicate that the issue was confined to a very specific subset of formulas, not to the very wide array of variable references that I found were not working for me.
Thanks,
Ethan