PSA: Link to recently created rows by UID, not RowID()

Requirement: with a button create a row and bring it up into focus (e.g. as a modal)

Problem: to bring out a row into focus, you need its RowID() so that you could construct its URL like:

OpenWindow(Format("#_tu9Wb/r{1}&modal=true", CreatedRow.RowID())

However, RowID() at this point may still be blank because the row is not yet stored to the server. And it will always stay blank if the doc is used in Play mode.

Solution: instead of RowID() use “true” 10-alphadigit unique row ID (UID) that is created on browser side as soon as the row itself is created.

One idiom to get this UID is by formula:

Split(thisRow + "", "/").Last()

The thisRow + "" returns grid-xxxxxxxxxx/i-xxxxxxxxxx table/row UID pair (which, I believe, is used internally to compare row references against each other), and we use Split("/").Last() to only cut off the row UID part.

Now you can use this identifier right away in your URLs.
Heads up: instead of r<RowID> parameter you’ll have to use ru<UID>, like:

OpenWindow(Format("#_tu9Wb/ru{1}&modal=true", CreatedRow.UID)

so that instead of /r123 your link looks like /rui-12345XzYuW.

E.g. here’s a button that creates a “helper table” row if it doesn’t exist (I’m using a helper table as a form to submit cross-doc updates), and immediately opens it as a modal:

This is one of the pro-tips that let you build docs that feel a lot like apps. There’ll be many more like this one on :slight_smile:

P.S. Updated one of my older demos. Play around with this embedplay: create rows and see how UIDs are added immediately and row IDs are not. Then click the “Pop me up” button and see that popups by UID work just fine :slight_smile:


That’s awesome!! keep them going :fire:

Peculiar behavior fact: links with UIDs don’t always work. There’s one case when they don’t:

  • When UID contains an underscore _
  • AND RowID is already present

If both of these conditions apply, the link with /rui-xxxxxxxxxx will not properly convert to a canonical row link with Row ID like it usually does. When there’s no underscore or there’s no RowID yet, it will always work.

Yet another update. Instead of manually figuring out whether to use ID or UID, you can just build your link with:

OpenWindow(thisRow.Url() + "&modal=true")

and the thisRow.Url() will automatically resolve to either _rui-xxxxxxxxxx format for rows with no Row ID, or to _rXXX row ID format for those that already have one.

If you need an URL based on a view of this table, you can always trim the ID/UID part from row’s URL like this:

1 Like

Hi @Paul_Danyliuk, I wonder if I’m running into this observation you’ve made when it comes to implementing your UID procedure into my doc. I followed your instructions on adding different buttons which open different views of a row. The purpose was to create a sort of “menu” for easy navigation while on mobile.

It works perfectly on mobile. But when I click the button on desktop, the URL will change while the view will not change on screen. When I first open a row (into any view) I can make edits to the row and click one of the other-view buttons. The first button click will work to change the view, but the second button click will not change the view.

Any advice? Thank you :pray::heart:

Could be that, yeah. That’s why better use the updated technique with Url() that always resolves to Row ID but falls back to UID when Row ID is not present.

There’s another thing too. Focusing on a row doesn’t reliably work (or always doesn’t work IIRC) when the view is in the same section as the button that you’re clicking. Could be that too.

In any case, hard to say without seeing the doc.

I tried using your thisRow.Url().Split("/_r").Last() formula, but got errors. Realized it was the /_r should be /r

Now it works as it did before with this syntax:

OpenWindow(Format("#_tuD-A/r{1}&modal=true", thisRow.Url().Split("/r").Last())

The behavior is the same as when using the raw UID :frowning: For some reason I cannot click to different views while in the same row’s modal…

Frankly it’s alright. I can just press esc to go back to table view, then press the other button as needed. Please let me know if you can reproduce this issue…

  • having multiple buttons for different views on a single modal
  • clicking between different views for the same row
  • behavior broken on desktop while perfect on mobile
  • using thisRow.Url().Split("/r").Last() to get the rID or ruID as necessary

This solution seems to work when executed alone, but if I execute the OpenWindow inside RunActions(), with some actions before, it sometimes prompt me to accept link navigation (and accept won’t work, only possible action is closing that modal), sometimes it will open a new tab to the origin table, and sometimes the notification says “[…] hyperlink executed” but nothing happen.

Maybe you can help me:
I am trying to create a button in one table (1) that executes several actions, like creating a row in other table (2), link it to a lookup column in current table, and then open a modal to edit the newly created row. Even more complicated, I would like it to work in the expanded detail of the first table.

            db_attachments, _aux=Concatenate(thisRow.Nombre,thisRow.ID), 
            _aux, Concatenate(thisRow.Nombre,thisRow.ID)
            thisRow, thisRow.[docs], 
                thisRow.[docs], db_attachments.Filter( _aux = concatenate(thisRow.Nombre,thisRow.ID))
           Concatenate(thisDocument.Url(), "_suZSC#_tuqlF/r", thisRow.[docs].Last().Url().Split("/r").Last(), "&modal=true")
           db_attachments.Filter(_aux = concatenate(thisRow.Nombre,thisRow.ID)), db_attachments._aux, ""

As you can see, first i create a row in table “db_attachments” and assign it an aux id so current table can find it, then I add its reference to current table, and then I try to open a modal (i have tried lots of combinations, I am aware this isn’t the most robust solution but i was desperate to try to make it work).

This actions are executed in a button in current table. When this is run, it won’t work, yet if I add another button just with the OpenWindow command it does work. So I guess it has to do with the ID / UID thing, since the only difference is when I click the second button, the row is already created.

And now, the question of the million dollars, I was trying to make this work in a expanded view for the current table: use case is you are examining detailed view of current table row, then you want to add it a related document so you should click this button, new empty document should add to the documents table, and then a modal to enter its data should open. When you manually do this, you navigate to this modal, but in the top left corner it reads " < Back" and you can go back to the previous modal.

Sorry, I tried to explained best way I could. I didn’t shared doc because its a huge doc, in spanish, and probably would be completely messy. I am doing to keep track of projects and processes in my small company.

-------------------------Update: solved-----------------------------------
Just working a bit more around this, i found a solution. Issue is related to Paul’s comment
Problem is new rows for me have an UID “_rui-41213…” with underscore, always
I found a simple solution: Instead of thisRow.Url().Split("/r").Last(), you can use thisRow.Url().Split("/_r").Last().Split("/r").last()

1 Like

There is a simple solution that works in every case:

Instead of: thisRow.Url().Split("/r").Last()
Use: thisRow.Url().Split("/_r").Last().Split("/r").last()

So when referring to a new row, you should use something like


It will extract the components even when the underscore is present in the UID