Hello,
I’m encountering an issue while generating JSON using the Concatenate
and FormulaMap
functions in Coda. The resulting JSON does not correctly reflect the values from my tables. Below is the formula I’m using:
Concatenate(
“[”,
Join(
", ",
thisRow.ProductosDoliDB.FormulaMap(
Format(
‘{
“id”: {1},
“type”: “{2}”,
“price”: “{3}”,
“tva_tx”: “{4}”,
“qty”: {5},
“remise_percent”: {6}
}’,
CurrentValue.[Product id],
thisRow.AlbProvDetalleCodaDB.Type,
thisRow.AlbProvDetalleCodaDB.Precio,
thisRow.AlbProvDetalleCodaDB.Iva,
thisRow.AlbProvDetalleCodaDB.Cantidad,
thisRow.AlbProvDetalleCodaDB.Descuento
)
)
),
“]”
)
The result I’m getting is as follows:
However, the expected result should correctly reflect the actual values from my tables, like so:
[
{
“id”: 6298,
“type”: “0”,
“price”: “24”,
“tva_tx”: “21”,
“qty”: 1,
“remise_percent”: 40
},
{
“id”: 25784,
“type”: “0”,
“price”: “45”,
“tva_tx”: “21”,
“qty”: 2,
“remise_percent”: 40
}
]
Here’s a breakdown of the relevant tables and their data:
Name | Price | Product id | Description | Label | AlbProvCabeceraCodaDB |
---|---|---|---|---|---|
ABBN22719 | 0.79 | 6298 | BASTIDOR 1ELEM.2MÓD. ZENIT PLATA | BASTIDOR 1ELEM.2MÓD. ZENIT PLATA | 0/533 |
9302 | 0 | 25784 | BRAZO TELÉFONO 2 | 0/533 |
IdPedido | S/Ref | Posición | Articulo | Referencia Articulo | Denominación | Cantidad | Precio | Descuento | Importe | Importe OK | Iva | Type | Crear Producto | Existe | Ref para dolibar | ProductosDoliDB |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0/533 | MIGUEL | 5 | 288523 | ABBN22719 | BRAZO TELÉFONO MONITOR VEO | 1 | 24 | 40 | 14,4 | 14.4 | 21 | 0 | system | true | ABBN22719 | 6298 |
0/533 | MIGUEL | 5 | 288524 | 9302 | BRAZO TELÉFONO 2 | 2 | 45 | 40 | 125,25 | 125.25 | 21 | 0 | system | true | 9302 | 25784 |
Copy of AlbProvCabeceraCodaDB
IdPedido Fecha AlbProvDetalleCodaDB Total Crear pedido json Id Proveedor ProductosDoliDB ProductID S/Ref
0/533 10/07/2024 0/533,0/533 139.65 [{
“id”: 6298,
“type”: “0”,
“price”: “0”,
“tva_tx”: “24”,
“qty”: 45,
“remise_percent”: 21
}, {
“id”: 25784,
“type”: “0”,
“price”: “0”,
“tva_tx”: “24”,
“qty”: 45,
“remise_percent”: 21
}] 1131 BASTIDOR 1ELEM.2MÓD. ZENIT PLATA,BRAZO TELÉFONO 2 6298,25784 MIGUEL,MIGUEL