json array and objects

Marco Vitrano marco.vitrano at gmail.com
Sat Mar 4 08:21:15 UTC 2023


Kelly ,
thank you so much for the help.
  I didn't realize  it was necessary a list with a row column.

Do insertsList.$define(insertedRow)
Do insertsList.$add(insertedList)

Now it works!
Thank you so much!



Il 04/03/2023 05:29, Kelly Burgess ha scritto:
> Hi Marco,
>
> I can generate json that matches your description with the following code.
>
> Kelly
>
> #
> # prep list of inserted records
> Do insertedList.$define(column1,column2,column3)
> Do insertedList.$add('00','Tyler','Durden')
> Do insertedList.$add('01','Maria','Singer')
> Do insertedList.$add('02','Robert','Paulson')
> #
> # prep list of deleted records
> Do deletedList.$define(column1)
> Do deletedList.$add('99')
> #
> # copy insert data to a list of rows
> Do insertedRow.$copydefinition(insertedList)
> Do insertsList.$define(insertedRow)
> For insertedList.$line from 1 to insertedList.$linecount
>     Do insertsList.$add(insertedList)
> End For
> #
> # copy delete data to a list of rows
> Do deletedRow.$copydefinition(deletedList)
> Do deletesList.$define(deletedRow)
> For deletedList.$line from 1 to deletedList.$linecount
>     Do deletesList.$add(deletedList)
> End For
> #
> # plug things into a row for JSON conversion
> Do jsonRow.$define(Schema,Inserted,Deleted)	## char,list,list
> Calculate jsonRow.Schema as 'tableName'
> Calculate jsonRow.Inserted as insertsList
> Calculate jsonRow.Deleted as deletesList
> Do OJSON.$listorrowtojson(jsonRow,kUniTypeUTF8,errorText) Returns jsonBin
> # Calculate jsonText as utf8tochar(jsonBin)	## inspect before writing
> #
> # write to a JSON file
> WriteBinFile(jsonOutPath,jsonBin)
>
>
>
> _____________________________________________________________
> Manage your list subscriptions at https://lists.omnis-dev.com
> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com



More information about the omnisdev-en mailing list