Using human-readable strings instead of UUIDs

Hi,

I have a database in which all the tables are keyed by uuids.
Sometimes, I would like to edit join tables in ReTool. For instance, I have a join table that joins 'achievement' to 'skill'; it has three columns, 'id' (auto generated uuid), 'achievement_id' (ID of an achievement, FK to table 'achievement') and 'skill_id' (ID of a skill, FK to table 'skill').

Displaying a long list of pairs of UUIDs to the user is not going to work well. Instead, I'd rather display the human readable names of achievements and skills (found in achievements.name and skills.name).

I can get tantalisingly close to this by using dropdowns and hooking them to a query which gets the contents of the achievements or skills table as appropriate. I can then assign the 'value' of the dropdown to the uuid, and the 'display value' to the human readable name. This works fine for displaying the values in the table, but I cannot do an 'update' like this.

This must be a very common use case; the world is full of tables with non-human-readable synthetic PKs that map to human-readable names. For example, I was able to implement a reasonable solution in about three minutes using internal.io. I'm not sure if I'm missing something very basic or if this is really something ReTool can't do.

Someone mentioned something about mappers and I do see a box marked 'mapper' in the details for my dropdown boxes, but I have no idea what goes in it. It's frustrating that the dropdown box approach gets me ALMOST all the way there!

Any thoughts appreciated.

Thanks,

Ben

Hey there Ben,

I'n not sure if you are still having trouble with this, but if so, a mapper is definitely what you are looking for here.

Lets say you have 3 queries:

  • Query1: returns the contents of achievements table
  • Query2: returns the contents of skills table
  • Query3: returns the contents of your join table
  • You can display the results of Query3 in a table in your app, then go to the column settings and use something like this to map the value in the column to a display value that is human readable:

    Now in the table it will be displayed like so:
    image
    And if I make a change, the recordUpdates object on the table will have the updated values (which are UUIDs)


    Let me know if this makes sense, or if you are having any trouble getting it set up.

Example app:
example.json (24.8 KB)