I’ve noticed that the only way to create a variable is either through global variables or component variables. But is there a way to create a variable that is only for a specific page?
I’m asking because if I have to create a global variable every time I need a variable, then two things are going to happen:
The names are going to have to be descriptive so that I and others understand where that variable is being used (i.e., pageNameVariableNameWhichCouldStatGettingLong and what happens if I change the pageName?!).
There’s a potential to have an overwhelming list of global variables!
The trick is to effectively plan out a folder structure that’s easy to understand for your variables. You can also bundle multiple variables into one by using an object variable and structuring your needs in that.
That is helpful and gives me some idea to organize things – particularly using an object. I guess I can create one object per page and use key-value pairs for each variable that’s needed for that page. Does that sound like a good idea?
I’m wondering if you can elaborate more on the folder structure. What would you propose?
The sad thing about folders is that they don’t show up in the list when picking a variable to use (see screenshot). So, it would seem, at least for the moment, that naming your variable with a scope (e.g., prefixing with the page name) would be a better way to prevent naming collisions and also make the variable easier to find.