Page 1 of 1

json files

Posted: Wed Jan 31, 2018 7:01 pm
by dkmccammon
Is there an easy solution to be able to extract the raw data from the json file on a screen and modify the text?

For example, we have a subfile that has mulitple rows, but only one column. We are wanting to set the detect subfile to false for the screen and then take the json file and parse out the data in the element in order to create multiple new fields, and overlay a grid in those fields. This would essentially make it to where we could make a one column subfile render as a multi column subfile.

In the json file I attached, as an example, we are wanting to get the info at

{
"type": "O",
"row": 6,
"col": 4,
"attr": "20",
"data": "OU40160335 TEST COMPANY LL TEST COMPANY L.L.C. 03/19/2017 CMP Renew",
"size": 76
},

and take this data portion, and parse the data out to where the OU40160335 would be in the first column, and TEST COMPANY LL would be in another, and TEST COMPANY L.L.C. would be in another, and the date, and then CMP and then Renew all in their own columns.

Re: json files

Posted: Wed Jan 31, 2018 7:06 pm
by Scott Klement
Why not retrieve the data from the screen?

I can't think of any easy way to get the json data, at least, not without modifying Genie. But, all it does with this data is create fields on the screen, which you can very easily retrieve. So why not just use them?

Re: json files

Posted: Thu Feb 01, 2018 11:05 am
by dkmccammon
Because Genie is putting the whole string into one element. We want the data in the element to be separated out into multiple different elements so that we can spread them apart and resize the columns, but when the element is only one column so to speak, you cannot do this without using the letter spacing or word spacing which does not align very well.

Re: json files

Posted: Thu Feb 01, 2018 12:12 pm
by Scott Klement
Reading it from the JSON file will also return it as all one element.

My question is why you cannot read it from the screen instead of the JSON file. If you write code to substring it and put it somewhere else you can do that just as easily after reading it from the screen as you could if you read it from a JSON document. But, reading it from the screen can be done right now without changing how Genie works, whereas reading it from a JSON file cannot.

Re: json files

Posted: Thu Feb 01, 2018 3:39 pm
by dkmccammon
Yes, I know that the JSON file will return it all as one element, but it would render the blank spaces differently, because the json file does not include the &NSBP; for a space, whereas it does for the innerHTML using javascript on the onload option.