@AndrewB
Sounds like things are progressing in a positive way!!
So here is the thing about collections, variables and datasources....they are all the same thing!! The distinctions are this:
- A DataSource is a table of records. It also has built into it the ability to "communicate" with the session table in the cloud that contains the real data. It will automatically sync the app datasource table and the cloud session table.
- A collection is a table of records. The only thing a collection brings to the table is the ability to add or remove rows easily.
- A variable is anything you want it to be...a simple boolean, text, number, etc. or a complete record, or a complete table of records. It does not have the ability to directly add or remove rows.
So, a DataSource has a lot of overhead to it. It has all of the data sync aspects that is pretty heavy on the app (but necessary)
A collection is a table with the overhead of the ability to add or remove rows. It is more heavy weight on your app to have those when not needed.
A variable has no overhead to it and can be anything.
So, looking at your initial collection. This would be less app intensive:
Set(NavItems,
Table(
{Id: 7,
ScreenName: Coalesce(varString.MakeRequest, "Make Request"),
Description: Coalesce(varString.MakeRequestDescription, "Contact us with a request"),
Screen: 'Request Screen',
Image: cc_icon_request,
URL: ""
}
)
)
NavItems is now a table with one record in it.
You can add as many as you want.
Now, about the admin part. If you have something distinctive in your table record to indicate the "audience"/visibility, let's say there is an admin column. Then your formula would be this (and I'll add another record for fun) :
Set(NavItems,
Table(
{Id: 7,
ScreenName: Coalesce(varString.MakeRequest, "Make Request"),
Description: Coalesce(varString.MakeRequestDescription, "Contact us with a request"),
Screen: 'Request Screen',
Image: cc_icon_request,
URL: "",
admin: false
},
{Id: 8,
ScreenName: Coalesce(varString.MakeRequest, "Make Wish"),
Description: Coalesce(varString.MakeRequestDescription, "Wish on your own time"),
Screen: 'Wish Screen',
Image: cc_icon_wish,
URL: "",
admin: true
}
)
)
Now, let's say you have some other variable in your app that indicates that the current user is an admin - let's call it varAdmin, then on your Items property for the Menu component, you would have this:
Filter(NavItems, !admin || admin = varAdmin)
For users that are not admin, they would only see record Id 7 from above. For those that are admin, they would see 7 and 8.
Hopefully that is clear and helpful for you.