Receiving Record Sets in Netlinx
sonny
Posts: 208
Greetings...
working on a module that will send back record sets and curious about your thoughts on preferred ways to deal with them once they arrive in Netlinx. The program will submit a query to the module and the module will return some number of records. Number of records returned could be 0 to MAX_RECORDS (not bounded at this point)
Ways I've considered include...
- comma separated list in one string...ie. '1,Bob,2,Dave,3,Mary'
- XML records in one string ie...'<records><record><id>1</id><name>Bob</name></record>....</records>' I could format this so that XML_TO_VARIABLE will work. This would work well because the server application sends the data to me over the network in this fashion. I haven't played with the XML stuff inside Netlinx much, but it seems a little picky about formation of the XML records.
- finally, each record in an individual string message...i.e. 'record-1,Bob', with a start and stop message. kind of an enumeration routine.
The Netlinx program must parse accordingly, then populate a user interface and report back the id of the record selected in a command...ie. 'LoadRecord-1'
Any thoughts, ideas or experiences would be greatly appreciated.
Thanks...Sonny
working on a module that will send back record sets and curious about your thoughts on preferred ways to deal with them once they arrive in Netlinx. The program will submit a query to the module and the module will return some number of records. Number of records returned could be 0 to MAX_RECORDS (not bounded at this point)
Ways I've considered include...
- comma separated list in one string...ie. '1,Bob,2,Dave,3,Mary'
- XML records in one string ie...'<records><record><id>1</id><name>Bob</name></record>....</records>' I could format this so that XML_TO_VARIABLE will work. This would work well because the server application sends the data to me over the network in this fashion. I haven't played with the XML stuff inside Netlinx much, but it seems a little picky about formation of the XML records.
- finally, each record in an individual string message...i.e. 'record-1,Bob', with a start and stop message. kind of an enumeration routine.
The Netlinx program must parse accordingly, then populate a user interface and report back the id of the record selected in a command...ie. 'LoadRecord-1'
Any thoughts, ideas or experiences would be greatly appreciated.
Thanks...Sonny
0
Comments
You might consider only retrieving only the number of records you will be working with. Your request could then include a max number of records to return and an offset to be applied.
For example: REQUEST:10,52 could request 10 records starting from record number 52.
You could also have a command to request the record count to prevent out of bounds requests, or handle the out of bounds within the module as needed.
Jeff
How about maintain the data in your Duet module, and use Netlinx interface to exchange only the required data to present on UI.
So use send_commands to define list size to duet, then send list update commands such as first, next, prev, last.
the unknown number of records is an issue since there is no dynamic memory allocation within NetLinx. Keeping the data on the Duet side is a good idea (thanks)....basically all I need it for in Netlinx is to populate a list box, which has only a limited number of records displayed at a time anyway.