[Progress Communities] [Progress OpenEdge ABL] Forum Post: RE: JSON reader not working if you have nested temp-tables using the same serialize-name

Status
Not open for further replies.
J

jbijker

Guest
Even when making use of PARENT-ID-RELATION it's still misbehaving: DEFINE TEMP-TABLE parent1 NO-UNDO SERIALIZE-NAME "parent1" FIELD cName AS CHARACTER SERIALIZE-NAME "name". DEFINE TEMP-TABLE parent2 NO-UNDO SERIALIZE-NAME "parent2" FIELD cName AS CHARACTER SERIALIZE-NAME "name". DEFINE TEMP-TABLE child1 NO-UNDO SERIALIZE-NAME "child" FIELD rID AS RECID SERIALIZE-HIDDEN FIELD cValue AS CHARACTER SERIALIZE-NAME "value". DEFINE TEMP-TABLE child2 NO-UNDO SERIALIZE-NAME "child" FIELD rID AS RECID SERIALIZE-HIDDEN FIELD cValue AS CHARACTER SERIALIZE-NAME "value". DEFINE DATASET dsTest SERIALIZE-NAME "test" FOR parent1, child1, parent2, child2 PARENT-ID-RELATION pc1 FOR parent1, child1 PARENT-ID-FIELD rID PARENT-ID-RELATION pc2 FOR parent2, child2 PARENT-ID-FIELD rID. DEFINE VARIABLE lcData AS LONGCHAR NO-UNDO. lcData = '~{"test": ~{ "parent2": [ ~{ "id": "2", "name": "parent2", "child": [ ~{ "value": "test2" ~} ] ~} ] ~}~}'. DATASET dsTest:READ-JSON("longchar", lcData). FOR EACH parent1: DISPLAY parent1. /* displays nothing, this is correct */ END. FOR EACH child1: DISPLAY child1. /* displays test2 with unknown id, this is wrong */ END. FOR EACH parent2: DISPLAY parent2. /* displays parent2, this is correct */ END. FOR EACH child2: DISPLAY child2. /* displays nothing, this is wrong */ END.

Continue reading...
 
Status
Not open for further replies.
Top