Trying to learn data manipulation in Glide :-/

I’m still trying to wrap my head, around the way data manipulation is done in Glide.

In this a thought up example, I’m trying to construct a string. I have found two ways of doing it, either to process the stings in steps as in the red block or via Excel formulas.

  1. First change Name to uppercase via the method “Other/Experimental/Text/Uppercase Text”
  2. Then replace the Space with a – (dash) via a Template replace.
  3. Now I load up the base-string from a Single Value pick (I like to have my “globals” in a collective store), formatted with [filename] and [ext] dummies.
  4. Then I construct the final string by replacing the [filename] with ‘Place_Dash’ and [ext] with “.jpg” via a Template-Replace (I know I could have saved the operation at 2 ‘Place_dash’, by replacing the space here)

What I really don’t like about this approach, due to the many columns you potential could end up with.

Then I looked into doing it through the method “Other/Experimental/Code/Excel formulars.”

It’s a bit more effective, but I still end up with one extra column ‘pick_single_val2’ – how wonderful it would be if you could use the Single Value in the Excel formulars and/or in Actions on the forms/display. I’m a bit surprised that there is no programming attached to the Actions.

BTW please notice that not all Excel functions have been ported, e.g. Substitution() is missing, so i had to take the long road with Replace() and Find()

Do I miss something or is there another way of conducting data manipulation is done in Glide?

You could use the javascript column, similar to how you used the excel column. Your code would look a little cleaner and easier to understand.

As for the extra single value column, what you could do instead is utilize the user profile table as your collective store. Anything from the user profile is globally available throughout the app without having to use a single value column to bring it into other tables. The javascript column can pull in parameters directly from the user profile table.

I’m no whizz at Javascript, but i forgot about my new best friend ChatGTP - he does a fine job translating my Python snippets :slight_smile:
So yes, JS is the way to go. It is super compact.

return p1 + p2.toUpperCase().replace(" ", “-”) + “.jpg”;

Can you elaborate on what you mean about using the User profile table for global vars?
I assume it will be only global vars, for the current user logged in??
If it is to be a true global vars available to all users, e.g. a base URL, surely it needs to be in a settings/helper table? Or have i misunderstood it?

If you utilize user profiles in your App and your users are signed in, then you can access values from the user’s user profile row all over the app in various ways.

Instead of using a Single Value column to bring a value into a certain table, and then using it in a javascript column for example, you can directly access the user profile value in your javascript column as a parameter.

What I’m saying is that instead of having a separate table to hold global values, you can set up those column within your user table. You could use a template column so those global values are populated on every user row.

2 Likes

Hi Jeff

You lost me on that part. What you are telling me is:

Name  Level   Base-url
Jeff  Expert  example.com
Otto  Newbee  example.com

Thats an elegant solution. But how the devil do you, so that the template function works ‘vertical’ rather than 'horisontal?

If you create a template column and just type some random text into it (not using any replacement values), it will put that same text on every row in the user table. So if you create a template column, name it ‘Base-url’, and type “example.com” into the template, it will be the same for every user row.

2 Likes

Wow ! That was a cool trick you taught me there.
Thanks for the help.
(Any more lifesaving tricks up your sleeve?)

1 Like

You can bulk manipulate columns with JSON files :wink:

1 Like

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