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 1315 times)
Reuben B.
Four Js
Posts: 937


« 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.

Read more at https://4js.com/ask-reuben/ig-29/

Product Consultant (Asia Pacific)
Developer Relations Manager (Worldwide)
Author of https://4js.com/ask-reuben
Contributor to https://github.com/FourjsGenero
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines