Project

General

Profile

Feature #10467

Make READ-JSON dataset handle method able to read json files not containing the name/serialize-name of the dataset

Added by Paul Bodale 11 months ago. Updated 9 months ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
Due date:
% Done:

0%

billable:
No
vendor_id:
GCD
case_num:
version_reported:
version_resolved:
reviewer:
production:
No
env_name:
topics:

Related issues

Related to Base Language - Bug #10352: Fix READ-JSON dataset handle method's behaviour Closed

History

#1 Updated by Paul Bodale 11 months ago

  • Related to Bug #10352: Fix READ-JSON dataset handle method's behaviour added

#2 Updated by Paul Bodale 11 months ago

While working on task #10352 I noticed that FWD doesn't support reading the following json:

{
   "Main" :  [ {
      "field1" : "main1",
      "Secondary" : [ {
         "field1" : "value1",
         "field2" : "value2" 
      }, {
         "field1" : "value1",
         "field2" : "value2" 
      } ],
      "field2" : "main1" 
   } ]
}

With a dataset with the following structure:

DEFINE TEMP-TABLE ttMain1 NO-UNDO SERIALIZE-NAME "Main" 
   FIELD field1 AS CHARACTER
   FIELD field2 AS CHARACTER.

DEFINE TEMP-TABLE ttMain2 NO-UNDO SERIALIZE-NAME "Main" 
   FIELD field1 AS CHARACTER
   FIELD field2 AS CHARACTER.

DEFINE TEMP-TABLE ttSecondary NO-UNDO SERIALIZE-NAME "Secondary" 
   FIELD field1 AS CHARACTER SERIALIZE-NAME "field1" 
   FIELD field2 AS CHARACTER SERIALIZE-NAME "field2" 
   FIELD syncMain1Field1 AS CHARACTER
   FIELD syncMain1Field2 AS CHARACTER
   FIELD syncMain2Field1 AS CHARACTER
   FIELD parent1Id AS RECID SERIALIZE-HIDDEN
   FIELD parent2Id AS RECID SERIALIZE-HIDDEN.

DEFINE DATASET ds SERIALIZE-NAME "DataSet" FOR ttMain1, ttMain2, ttSecondary
   DATA-RELATION FOR ttMain1, ttSecondary RELATION-FIELDS (field1, syncMain1Field1, field2, syncMain1Field2)
   //DATA-RELATION FOR ttMain2, ttSecondary RELATION-FIELDS (field1, syncMain2Field1)
   PARENT-ID-RELATION FOR ttMain1, ttSecondary PARENT-ID-FIELD parent1Id
   PARENT-ID-RELATION FOR ttMain2, ttSecondary PARENT-ID-FIELD parent2Id.

This works just fine in progress. FWD prints this error:

Dataset name 'Main' in JSON does not match 'ds'. (15375)

#3 Updated by Constantin Asofiei 9 months ago

Paul: is this fixed already by other tasks?

#4 Updated by Paul Bodale 9 months ago

I tested with both trunk and 9457c again today and no.

Also available in: Atom PDF