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
JS Array Values to RPG Program
-
- Profound User
- Posts: 45
- Joined: Tue Mar 11, 2014 2:50 pm
- First Name: William
- Last Name: Negley
- Company Name: Utz Quality Foods
- Contact:
-
- Experienced User
- Posts: 2711
- Joined: Wed Aug 01, 2012 8:58 am
- First Name: Scott
- Last Name: Klement
- Company Name: Profound Logic
- City: Milwaukee
- State / Province: Wisconsin
Re: JS Array Values to RPG Program
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.
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.
Who is online
Users browsing this forum: No registered users and 5 guests