Page 1 of 1

JS Array Values to RPG Program

Posted: Wed Oct 29, 2014 9:13 am
by negley
I was wondering what the best practice would be when moving data from a javascript array to the RPG program.

I am creating a mobile application that holds data in localStorage when internet is down. When the unit comes back online, it will loop through the localStorage. I can write the data to a grid and then process in RPG, but that seems inefficient. I could also create a string of data that is comma delimited, and break the comma, but that also seems inefficient. What other methods would work best?

-Bill

Re: JS Array Values to RPG Program

Posted: Thu Oct 30, 2014 12:21 am
by Scott Klement
I wouldn't put it into a grid unless a grid was already needed for the application.

Writing it as comma-delimited data seems like a decent solution. Another way would be to put it in XML or JSON format (into a large character field) and then parse that in the RPG program. XML might be convenient since RPG has a built-in XML parser.

But, a lot depends on what type of data it is and how it's used in the application. If this is data that was already in a grid to begin with, and then got saved to localStorage because the server was unreachable (or something). Then it makes a lot of sense to put it back in the grid -- after all, that way the user can see it, and it'll be natural to work with in RPG.