To explain and better understand this structure with the information in this output formats, we will use an example: the result of a reading operation. It is specifically about the record read, with code 2, from the LK.ORDERS record. In the example that is shown below line breaks have been added for a better explanation of their structure.
JSON Format
This is similar to the database record structure. It will use the dictionary names to create the nodes name and do nothing with the mv and sv marks.
Line breaks have been added for clarity.
{
"TOTAL_RECORDS": "1",
"RECORDS": [{
"LKITEMID": "2",
"CUSTOMER": "73",
"DATE": "17566",
"ITEM": "101105",
"QTY": "286",
"PRICE": "271.18",
"DELIVERYDATE": "17619ü17659",
"QTYPARTIAL": "143ü143"
}
]
}
JSON Properties
•The second level nodes names always correspond with the properties names of the LkData class. For instance in an EXECUTE operation you will find CAPTURING … and RETURNING … properties.
•All RECORD tags represent a mv record. All of them have an special property, LKITEMID, that represents the item-id of the record. They can also have another one, ORIGINAL_RECORD, that has a copy of the record in mv format. You will have this property if you have activated the option "Original Record" in the read. All other tags represent the record. If the attribute has a dict, the property will be the DICT. If there are not dicts, Linkar will add the word LKFLD+the attribute number (f.i. LKFLD1 for first attribute).
•Both, real attributes and calculated fields, are part of the RECORD properties. You can always know what kind of data are each one using the DICTIONARIES and LKPROPERTIES functions.
JSON_DICT Format
This format uses dictionaries data in order to create a more complex structure. It uses the data defined in Assoc or Structure attributes in the data bases that allows them. If it uses the structure (control-depend) definition like D3 it will name the groups with the MvGroup property.
This only has effect inside the RECORD property, so we only show this one.
{
"LKITEMID": "2",
"CUSTOMER": "73",
"DATE": "17566",
"LstItems": [{
"ITEM": "101105",
"QTY": "286",
"PRICE": "271.18",
"DELIVERYDATE": "17619ü17659",
"QTYPARTIAL": "143ü143"
}
]
}
You can see that Linkar has expand the multivalue groups using the dictionary information. Each group has a property, f.i. LST_LstItems and inside it another one for each multivalue attribute of the group, LstItems.
Linkar uses only dictionary information for this format, so it cannot process subvalues with this output format.
JSON_SCH Format
This format uses the Linkar SCHEMAS properties, that allows it to generate even more complex structures using also subvalues.
This only has effect inside the RECORD property, so we only show this one.
{
"LKITEMID": "2",
"CUSTOMER": "73",
"DATE": "17566",
"MvItems": [{
"ITEM": "101105",
"QTY": "286",
"PRICE": "271.18",
"SvDeliveryDates": [{
"DELIVERYDATE": "17619",
"QTYPARTIAL": "143"
}, {
"DELIVERYDATE": "17659",
"QTYPARTIAL": "143"
}
]
}
]
}
As you can see, now the subvalues use the same kind of structure, one property for a subvalue group, LST_SvDeliverydates, and another one for each subvalue in the group, SvDeliveryDates.
Linkar can do it using the information defined in Linkar Schemas. You must define SCHEMAS in order to use this property.
If you wish you can experiment with the Linkar TRAINER program, executing Read functions, with different ReadOptions to see the different results. With this program, you can execute all the available clients functions with all their options.