Lock choice component to user

This is a classic google sheets app. I want to lock the choice to the user while the user is working with the choice. Is that possible?


Use a user specific column to store the choice value.

1 Like

I am not familiar with the use of the ‘user specific column’. Grateful if you could describe the steps!

To give the full picture, the CurrentID is looked up and &included& in an URL

Just add a new basic text column and check the box for ‘User Specific’. Then use that with your choice component instead of the existing column you are using now.

The user specific column does not show up in Google Sheets. How do I extract the currentID from the Glide table and then include it in the URL?

Sorry I might have been misleading you.
EventChoice =N2&" "&O2
CurrentID=left(R2;7)
CurrentTĂ€vling=vlookup(S2;N1:P;2;false)
CurrentTL=vlookup(S2;N1:P;3;false)

Well, user specific columns are internal to Glide, because they can store multiple values for multiple users in the same cell.

Your options are to use the a column in the user table instead because user profile columns are available everywhere in the app, or move your logic to Glide so you aren’t reliant on Google sheet formulas.

Thanks Jeff, I understand. As you know, I’m 83 now and it’s too hard for me to move from Sheets to Glide tables. What are the Glide equivalents to the above Google formulas and this concatunated url:
=“https://www.golfbox.se/livescoring/tour/?language=1053#/competition/“&$S2&”/players”
My intention is to move the logic to the Glide built in Data table. Wouldn’t that be possible?
:nerd_face:

template column

text slice column

Relation/Lookup columns

Relation/Lookup columns

Template column or Construct Url column

2 Likes

Also should mention that you don’t have to switch to a Glide table if you don’t want to. Glide tables will save you a ton on updates, but that’s all up to you. All logic can still be moved to a Google sheet table with computed columns.

2 Likes

The data source is an importrange from an external spreadsheet. How can I keep it live in a Glide Table?

Same as you are doing now. The basic data comes from the google sheet, and you add the computed columns to the same google sheet table through the guide data editor. Like I said before. You don’t have to switch to a Glide table. Just use your same Google sheet table, but move the computed logic to glide using computed columns instead of sheet formulas.

My main app is mostly google sheet tables, but the calculations happen with computed columns in those same tables. It’s a heck of a lot faster than using google sheet formulas and waiting for data to sync back and forth.

2 Likes

Works great, avoiding sheet syncing increases performance dramatically! How do I “Slice from right”? Is it possible to use REGEXTRACT?

You could potentially still use text slice. Is your value a consistent length? Would you always get the same number of characters from the right? Do you have any examples of what you have and what you want for a result?

1 Like


I would like to extract:
4801699 consistent length
El Higueral varying length
2025-03-09 sön 11:00 consistent length

You can use a JavaScript column for this.

Each would contain a function like this:

function extractComponent(inputString, component) {
    // Define a regular expression pattern to extract all parts
    const pattern = /(\d{4}-\d{2}-\d{2})\s([a-zA-ZĂ -ĂčÀ-Ù]+)\s(\d{2}:\d{2})\s([\w\s]+)\s(\d{7})/;
    
    // Execute the regular expression on the input string
    const matches = inputString.match(pattern);

    // If there are matches, extract the required component
    if (matches) {
        switch(component) {
            case 'timestamp':
                // Return the full timestamp (date + day + time) exactly as it is
                return `${matches[1]} ${matches[2]} ${matches[3]}`;
            case 'location':
                // Return the location, trimming any extra spaces
                return matches[4].trim();
            case 'id':
                // Return the ID
                return matches[5];
            default:
                return null;  // Return null if an invalid component is requested
        }
    } else {
        // Return null if no matches are found
        return null;
    }
}

return extractComponent(p1, p2)

Then you pass p1 and p2 like this.

p2 can be “timestamp”, “location” or “id”.

2 Likes

Looks like @ThinhDinh beat me by minutes, but this is what I came up with. Somewhat similar, but a slightly different approach. I only did one javascript column, but split the values afterwards. I put it into a template app so you can copy it and see how I set up the columns.

2 Likes