Fetch JSON and JSON transform

Hi,

I have read a few posts and I just wanted to confirm I understand this correctly.

Objective. When a customer calls us, I want to see if the customer history of tickets. I have an API that given a customerID it will return all the tickets in the table (last 10 tickets).
I then want to show these 10 tickets in an inline list. Each record will return about 5 attributes for the historical ticket. (ticket date, category, rating, custName, company)

Stage 1:

  1. First I need to use a JSON Fetch to call the API with the customerID, this will return the JSON object.
  2. ?? Do I need to create the JG parser to break up the values into 5 different columns ?

Stage 2:

  1. create a new sheet to create the records/tuples following this structure gifted by Darren Murphy Fetch Data from API and display array result in Collection - #3 by piratenkoch (thanks)

questions

  1. is this the best way to do it
  2. how do I ensure that if there are multiple users doing lookups they don’t override eachothers data ? I assume I can use the USC for the vehiclereg input in stage 1 but how do I do it for the “helper table”

You can either write it directly to your helper table, or use whatever method makes sense to get it in there. Could be a single value, could be a relation + lookup. Whatever.

As long as the source column is User Specific, then every computed column that refers to it will also become user specific. This is the beauty of the helper table approach. You can (in theory) have one million users all working in the same single row table at the same time, and everything works perfectly with each user getting their own unique experience.

2 Likes

Thanks @Darren_Murphy

This is very interesting and powerful. I think I follow what are you saying. I will give it a shot.

Just for clarification. When you say “helper table” is that a Glide attribute or its just a regular glide sheet that you are referring to as a helper table.

1 Like

It’s just a regular Glide Table. Some people call them “working tables”, I like to refer to them as “helper tables”. In general, they contain very little (and sometimes none at all) actual data. Just a bunch of user specific computed columns used for performing a specific task, or series of tasks.

4 Likes

This is coming along very well, thanks for help.

One quick question, when I am creating my working table, is there any way to create dynamic rows, as I am searching history, different searches will result in different number of results. I don’t mind creating 20 different placeholders but when I am displaying the inline list, I don’t want to be displaying empty records.

I think you need to create the max number of rows you would ever need. I would think you would be able to filter out the empty rows.

2 Likes

Thanks Jeff. works perfectly

1 Like

I am hitting another issue.

Currently I have a text entry component on the main page adding data to a USC row. Each time a character is entered it is making an API call which is causing unnecessary API calls.

If I create a form button, when I hit submit then it is creating a new ROW in my “helper table” but I want it to write to the first row of the USC.

Let me know if further clarification is needed.

I would create a second USC column that your API will use. When you fill the first USC, then have a ‘submit’ button with a set column action to copy the value in the first USC to the second USC column. That way, the API should only be called when the second USC value is changed.

HI Jeff,

I was trying something similar, but my issue is that it creates a new row at the bottom and the information is added the that row. I need the information to be added to the USC in the first row, so the working table can be populated


As per screen shot, I am trying to add the data to the first row of the USC, I don’t want any additional rows added.

Hi! I think you thould use edit or new screen insted of using form screeen. Also you dont need any edit or new screen just directly use text edit to first us column then press button which had copying to second us column according Jeff’s sudgestion

1 Like

Ar you using a Set Column action or an Add Row action in your button?

I feel I am doing something stupid… let me share some screen shots

In the back I am using an API to pull in a JSON object and then breaking that up using 2 working tables and then using 2 inline lists to present the data. This first image shows it all working fine, but the issue is that every letter inserted is causing an edit + API call.

So to test the new suggestion, I am adding a form button
image

which when clicked opens up a form, where as suggested I am using “set coloumn action”

I either found a solution or a hack. Instead of using a button to open a form I am using edit screen action and then changing the USC column. It doesn’t insert anything until I do not hit DONE.

Not sure if this is the best way, but it seems to be working.

Don’t use an edit form, regular form, or any form for that matter. What I’m suggesting is a button with only a Set Column action. That button won’t open a screen.
It simply uses the Set Column action to move the value from one column to another. Everything can be handled from your same detail screen without leaving that screen.

3 Likes

Thanks Jeff I new I was doing something wrong… all of a sudden the lights switch on That works.
:slight_smile:

1 Like

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