VILLY
March 3, 2023, 9:56am
1
Hello, i vould like decocde this json text to send into two gobal variable
fist is date1 with "value" from "custom_fields_list" where "id=24683" and the second is date2 with "value" from "custom_fields_list" where "id=24684"
{
"id": "654",
"title": "Titre",
"reference": "My Ref",
"description": "",
"serial_number": "508277",
"id_customer_supplier": "271850",
"custom_fields_list": [
{
"id": "24683",
"title": "Date1",
"value": "2023-02-01",
"value_text": "01/02/2023"
}
{
"id": "24684",
"title": "Date2",
"value": "2023-02-01",
"value_text": "01/02/2023"
}
],
}
Thank for your help
do these edits
and copy and paste the wholes json string into the site below so you can see the structure
1 Like
VILLY
March 3, 2023, 11:42am
3
ok but my problem is how can i get value from date1 and value from date2 ?
Try to use
list by walking path [make a list, custom_fields_list, Walk at all level, value_text]
This will return all the dates as a list
VILLY
March 3, 2023, 12:17pm
5
ok, i've made those 2 blocs
but now how can i send to lblAchat value where id=24683 and in lblInstall value where id = 24684
Both will return same list of values . If you have only two values then (so) use select list item list block , use index 1 for first lable and use 2 for second list
Else just use one common procedure
VILLY
March 3, 2023, 12:25pm
7
Sory but i don't undestand
Will you store too many values in future in the dictionary? Or only these two values
VILLY
March 3, 2023, 12:35pm
9
I only need those two value
i can use ID to make difference betwwen those 2 values.
ABG
March 3, 2023, 3:06pm
10
Here is my take on this, using one of the new list blocks.
It might be tighter using the reduce block.
JSON_map_reduce.aia (3.6 KB)
Extra steps might be needed depending on your JSON source.
ABG
March 3, 2023, 3:31pm
11
Here's another way todo this with the list reduce block:
JSON_map_reduce.aia (4.9 KB)
I assumed only one pair list would be returned, allowing the cumulative text JOIN to work.
1 Like
VILLY
March 3, 2023, 7:21pm
17
Thank for your help but i always got error
my code is like that
error is "Bad agruments to Elements
The operationElements cannot accept the argument:, [""]
ABG
March 3, 2023, 7:29pm
18
Export your .aia file and upload it here.
ABG
March 3, 2023, 7:35pm
19
You load Elements from global customField, but where do you load global customField?
P.S. Elements will only accept a list, not a piece of text.
Look in the list blocks palette for the block that creates an empty list if you want an empty list.
VILLY
March 3, 2023, 8:12pm
20
I've made little modifcation because usualy JSON came from website
Mat5.aia (65.0 KB)
ABG
March 3, 2023, 8:31pm
22
This will eliminate one source of that error message.
Check the rest of your global inits yourself.
TIMAI2
March 4, 2023, 12:29am
24
Not sure why everyone has made it so complicated ?
2 Likes
He doesn't want both these value in a label as a list
Instead as per id he want to print the value . So we have suggested the way