If a user is missing some data (in this case, a list of groups they’re a member of (“MyGroups”)), I want to show them a message telling them to go complete it.
The debugger shows that this user is missing this data:
I put the formula COUNT(data.MyGroups) into an alert and it returned 0.
But when I use an IF condition COUNT(data.MyGroups)==0, it continues as though that’s false. It also returns false for COUNT(data.MyGroups)<=0, COUNT(data.MyGroups)!=0 and COUNT(data.MyGroups)===0.
Eh?
App # 98690
Page: My Plans
Page logic
Try IS_EMPTY(data.myGroups)
or COUNT(IF(!!data.myGroups, data.myGroups, [])) == 0
if you feel like counting.
It’s because of myGroups
passing undefined
when there’s no data. The data gets populated before you look at debugger so it looks like valid []
(race to get the data before code execution).
1 Like
Anyhow might be a more robust idea to directly bind the components visibility property to the formula rather than programmatically show or hide it.
And rather use IS_EMPTY
formula, which handles correctly even if it’s undefined
1 Like
@Sasu_Makinen, thanks for helping me better understand the race error. Now I know how to check for that more accurately.
I ended up putting a GET records step into the flow and referencing that rather than the data variable to ensure that everything happened in the right order. It worked 