Relate 2 tables to send JSON

Hi, nice to meet you. I'm Juan Isidoro,
I need your help with the following problem. Hope someone can help me. Thank you very much ^^

I have 2 tables, where each "Product" row has its “name”, “price” and “categories” (Nombre, Precio and Categorias in Spanish). And each category has an associated "ID_EXT" in the "Categories" table.

INTRODUCTION
Product ID=867c1b4e | Name: "Camiseta Woo"
It belongs to the category: “Ropa”. This value, in the "Categories" Table, has an associated external identifier: "CategoriaID_Ext", in this case "12".

tablas.jpg

 

EXAMPLE WITH THE PROBLEM
Product ID = 74244351 | Name: “High pink socks” ->  Categorias: Calzado, Tenis -> CategoriaID_EXT: 14, 26

ExampleWithProblem.JPG

 Currently I send in a JSON where I include the information and the categories

json.JPG

 

EL JSON, es:

JSON BodyJSON Body

 

 

 

 

 

 


In the TEST it is executed correctly (using Make, old Integromat)

RequestOK-make.JPG

But I want, instead of receiving the categories: "Calzado, Tenis". Receive the IDs corresponding to the table: "Categorias", in the column: “CategoriaID_Ext”.

That is, I want to receive:

this is the answer i needthis is the answer i need

 

 

 

 

 

 

 


How could I solve this? And what will be the most efficient way?


Thank you so much beforehand! 😉

Solved Solved
0 9 389
1 ACCEPTED SOLUTION

The correct way to do this is:

  1. In the Productos table, your Categorías EnumList column should have a base type Ref pointing towards the Categorías table. The column will contain CategoríaID values instead of Nombre.
  2. You can mark the Nombre column in the Categorías table as Label, so that you can see the Nombre values in all app views. 
  3. You can then use the following expression in the template directly:

    {
       ...  ,
       "Categories":  "<<[Categorías][CategoríaID_EXT]>>",
       ...
    }

Please read these:

View solution in original post

9 REPLIES 9
Top Labels in this Space