Subscribe for automatic updates: RSS icon RSS

Login icon Sign in for full access | Help icon Help
Advanced search

Pages: [1]
  Reply  |  Print  
Author Topic: Ask Reuben 29 - Read/Write Variables From/To A File  (Read 4016 times)
Reuben B.
Four Js
Posts: 1048

« on: May 22, 2020, 08:37:13 am »

Occasionally you have a requirement to read or write a complex variable from or to a file.  This could be during debugging, you want to read a complex variable or perhaps compare it to an earlier value to find the difference.  This could be during QA where you want to populate some variables with some known values or again compare the difference with an earlier saved result.

There is a handy little technique you can use that involves JSON and the TEXT datatype to read/write any given variable from/to a file.  Use the util.JSON.stringify method to turn a complex variable into a JSON string and write this to file.  Going the other way read a file that is a JSON string and parse that into a complex 4gl variable.


Product Consultant (Asia Pacific)
Developer Relations Manager (Worldwide)
Author of
Contributor to
Pages: [1]
  Reply  |  Print  
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines