Forum Discussion

JeffHughes's avatar
JeffHughes
Qrew Trainee
2 days ago

Getting the DBID from an Alias

I want to be able to put a text field into a cell and it be the table alias, then another formula field that converts it to the DBID.

Reason being when we copy an app, the tables stay the same, but the DBIDs all update and we have to go manually change all the juiced URLs.

  • For the Document Templates take you can change the fields which hold the table IDs and the App IDs to be formula fields.  That will break the Juiced configurator tool as it won't be able to write to them, but for the parent template table, Its really just a list of fields which you cab maintain manually.

    But the syntax for the settings field for the Subtables would be horrible to do manually, virtually impossible.  I think you would need to ask Juiced for a suggestion.

    • JeffHughes's avatar
      JeffHughes
      Qrew Trainee

      I just need a formula that converts alias to DBID.

      We copy apps, and then have to go change the formula of every document template and sub template through grid edit and change out the DBIDs.  I have to have two screens and lookup the new DBID.  If I had a field in there that could just lookup the dbid based on the alias, the alias doesn't change, so I could essentially grid edit and then just copy paste rapidly into the formula.

      I found API_FindDBByName, just not sure how to convert that into a rich text field.

      • MarkShnier__You's avatar
        MarkShnier__You
        Icon for Qrew Legend rankQrew Legend

        OK, now I finally understand the challenge.  Took me a while to "get it".

        Not saying it's pretty but here is a solution.

        For the Document Subtables report make a long formula field like this.

        Case([Record ID#],

        1, [_DBID_CUSTOMERS],

        2, [_DBID_PRODUCTS],

        etc.

        Then you add that field as a column to the report and use copy paste to fix the table ID which is embedded in that crazy long Juiced string.

        Similarly, you do the same idea with the Document Templates table.  The App ID will just be the formula AppID(),  and if it needs that Document Subtables ID then that also would be like

        [_DBID_DOCUMENT_SUBTABLES].

        But for the Master table dbid, that would be another long Case statement. 

  • Have you tried using the DBID() formula in a Formula Text field?

    https://login.quickbase.com/nav/app/9kaw8phg/table/6ewwzuuj/action/dr?rid=137&rl=8g

    • JeffHughes's avatar
      JeffHughes
      Qrew Trainee

      This is what I need, but I want to be able to pass the alias into it rather than it telling me the current DBID.

      • MarkShnier__You's avatar
        MarkShnier__You
        Icon for Qrew Legend rankQrew Legend

        ...  but if you copy the app and hence copy the Juiced URL button then the button will still be correct, right?  It will refer to dbid() which will be the new table, right?

    • MarkShnier__You's avatar
      MarkShnier__You
      Icon for Qrew Legend rankQrew Legend

      The alias for the table name is shown in Advanced table properties.  So if the Juiced formula needs the table ID of another table different from the one that the button is on, then you refer to the table as like

      [_DBID_CUSTOMERS] 

      or dbid() for short if the table is the one where the URL formula button is button is.

      If you need to reference the APP id then that is AppID()

      • JeffHughes's avatar
        JeffHughes
        Qrew Trainee

        Correct.  But I want to build a field in Document Templates called "Table Alias" and then formula called "DBID lookup"  so I can put [_DBID_CUSTOMERS] into the Table Alias in Document Templates and then a lookup field that tells me what dbid that alias is representing.   So I can then quickly grid edit all of my document templates.