AI Component Limitations for Choice Selections

Okay - beating my head against a wall on this one. Having success using the Glide AI component to make choice lists that can perform actions. Cool.

Where I am stuck is that the only way I can get choice lists to appear as options in AI choice lists is to use joined lists. This gets me half the way there…

I need to decrement the count of an item if its selected from the list. I associate the updated count to the item so the choice component lists each item name and each item count from the two joined lists

item 1 name (count) * note this lists the first values in the joined lists
item 2 name (count) ** note this lists the second values in the joined lists
and so on

BUT

I need to update the original item count from my items list. this is the list that provides data to the joined list i use in the component.

the only value I can update is always the first row of the table. I am unable to access the row of the selected item from the list. grrrrrr.

The AI will tell me the updated value that is displayed on screen but I need to know how i can persist that value so I can them run an action to update the new count in the original list.

Realize its tough to explain - but I imagine someone has run across this before.

signed, desparate :slight_smile:

So it does have to be updated on the click, or you can theoretically push an update later with a button?

I find using JSON in your case much easier than joined lists, though, I prefer to keep as few variables as needed.

I can update it later as opposed to right on the select. Will explore the json approach. Thanks

I have created a JSON object and a json query column that populates the names of my choices. When i swap out my joined list in the AI component with the json query column i only see the *first row listed in my choice component.

*The choice list in the AI component needs a comma separated list to populate multiple items. the query JSON column only contains single values - hence the listing of only a single row in the choice list

Questions

  1. Can the glide AI component make a choice list from a json query column or do i need to convert that into a joinedlist ?

  2. I’ve looked through the glide docs on JSON and objects and queries and must be missing something. i have all the columns of the data i need in my items table. i don’t understand what value it is to 1- combine these columns into a new json object, then 2- create queries that filter to the specicif column - i just end up with duplicate columns of the data already in the table.

I would suggest you starting with the JSON from scratch (with a brand new component), and actually feed a sample of it to your component so it knows how it can be queried. Else, you’re just letting it trying to guess what the queries should be (i.e column names).

You should use a JSON object to convert row-level values into a JSON, then combine them together, let’s say in the Users table, with a lookup, and then another JSON object to convert it to nested JSON array.

{
    "data": [
        {
            "item": "item 1",
            "attribute1": "value1"
        },
        {
            "item": "item 2",
            "attribute1": "value2"
        }
    ]
}

I imagine something like that.

The “library” that Glide uses has a “template” function that is built for this exact stuff. Here’s an example on using JSON.

1 Like

thanks for the help. i got this working using a look up in users from the original table.

1 Like

btw - i checked out this again - and now that I am more familiar with JSON objects - I see how powerful this approach is generically. Definitely in my bookmarked Glide list. thanks

1 Like

Yes, definitely my favorite way to build with JSON.

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