"global" variable for app

Hi, if I want to copy an app for use by more than one client, is there an easy way to get the app name, or some other identifying information? It would be great to have a “control file” type record in the app where fiscal year start date, client name and other client-specific information could be used for use in email composition, static screen messages, etc. I tried setting up a single-record table and doing a “lookup column” to that record in the user table (which is the only table I can see available anywhere), but then the lookup column is not available when building template replacement columns, etc. I guess what I’m looking for is a single-record table that is available for anything, just like the user record… – Perhaps just give us access to the “app info” table and allow us to add fields to it.

Your idea with the user profile record is a good one. The lookup may not be working because it’s referring to a multiple relation instead of a single relation.

Another option is to create a single table, but then in every other table that needs it, you can create a single relation and the necessary lookups. Also instead of the relation/lookup combination, you can just use a Single Value column to pull specific columns or rows from another table without the need for a relation.

OK, I didn’t know about “Single Relation”… So I used your suggestion to set it up as “Single Value”.
That is simpler anyway. So, then that works to set up the values, but perhaps I don’t understand how templates work, or where they can be used. I set up a template in the user record which has a replacement of %ADMINEMAIL% to the single relation lookup in the user record field “Admin Email”.

image

But in a “Hint” field, the value remains unchanged… How do I get the system to see that template of the current user?

image

The video for TEMPLATES is out of date. I am finding a lot of help videos that need to be remade to reference updates to Glide.

“Replacements” refers to the template field in which you wrote Control Record.

In your case try putting in your replacements field “Control” for one of them and “Record” for the other. (Instead of %CLIENT% and %AdminEmail%)

1 Like

This is the part of the video I just don’t understand. They don’t show what table this refers to. Do they have a single-record table that has templates in it? That could possibly answer my need…

Can you send us the video you are referring to?

Also, in your screenshot of the video, it looks like it’s a template that hasn’t been replaced by specific info (in this case, product name).

The use case of that video probably is to dynamically show that message with the variable being the product name, when the user visits each product.

Hi,

This is the link to the video…

Jack was using a single row in a table to allow himself to change the template right from inside the app.

If you have access to the builder and don’t really need to exclusively change that from the live app then you can just add a template column in the Products table and input that whole text inside the template column instead of having to get a single value column like that.

I guess I’m thinking too much like a programmer. It seems a waste of DATA space (I’m using Glide tables) to set up a column on EACH ROW that contains essentially the same information, with the exception of a few replacements. Of course, I don’t know how Glide handles that internally, but if I’m adding 512 bytes to each row, and all I’m replacing is the Admin Name and Admin Email, that’s a lot of wasted database space and could potentially slow down my app. In his example, it looks like he was able to simply create a “returns policy” one time, and uses it over and over. How can I do that? Am I looking at this wrong? I did get it to work once I understood how templates actually work – and it’s neat! But I’d like to know I’m not wasting space, or am I?

Well, I also don’t know how Glide handles that internally but if you’re worried about it slowing down your app then I don’t think it affects the whole thing to the extent that you have to worry about it. I find the template column pretty useful to make dynamic text like that, I use it a lot.

As I said in my previous reply, he was using a single row in a different table to do that, then cast it to all rows in the Products table using a single value column.

1 Like

A template column is a computed column. It’s not like a basic column that actually contains data. I don’t know exactly how glide has it structured to work either, but I would assume that the template value is only stored once and transmitted to the user’s device once. Then the code that runs on the user’s device is what gives it the appearance that it’s populated in each row. Computed columns, such as templates, don’t contain data. They are just a set of instructions that tell the app how to read, interpret, manipulate, and display the data in each row based on other values in that row.

I really don’t think you have to worry much about it slowing down your app. If you have a lot of data and a lot of computed columns that have to compute and calculate that data, or do complex calculations, then that’s when things could slow down a bit, but usually it’s only on the initial load of the app when it downloads all of the data and then has to do the initial calculations on all rows to compute the values for those computed columns. Once everything is loaded, then I think any additional calculations happen only on rows that were edited.

5 Likes

Thank you! Everything is working, so I won’t worry about data use because the Template is a computed column. I will let Glide worry about it.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.