| |
| Publicado el 18,marzo 2016 - 15:40 |
Hi, have you a best way to pass a variable of record type or an array of records to a WebService function?
I've already tried to use Serialize/Deserialize, but they don't works with the record variable.
Thanks, Dann |
| |
| |
| | | |
|
| | |
| |
| Publicado el 18,marzo 2016 - 16:24 |
Hi Dann,
you can use UML to create structures or classes from your files or queries. Then you can use the record variable to fill the structure before "serialize" it. Backwards you can use "filetoarray" to fill the array of structures or classes from your qery in the webservice. |
| |
| |
| | | |
|
| | |
| |
| Publicado el 18,marzo 2016 - 16:58 |
Hi Michael, thank you very much for your reply. I'd like to use a global procedure to manage the records of every table in the database. I prefer to not create a class/structure for every table, I prefer to use a "dynamic variable" (such like the record variable). |
| |
| |
| | | |
|
| | |
| |
| Publicado el 18,marzo 2016 - 17:04 |
Hi Dann,
UML runs full automatic. If you find a better way, let me know. I´m in the middle of recreating my old WD14 program from native HFSQL access to a completly webservice access. It´s a pain, because every little database access must through the "serialize/deserialize"-process .... |
| |
| |
| | | |
|
| | |
| |
| Publicado el 18,marzo 2016 - 20:06 |
I would experiment with the variant. I'm pretty sure it can be serialized/deserialized and it can handle structure like data in an array format. I can't remeber if it can handle an array of record variables.
Stewart Crisler |
| |
| |
| | | |
|
| | |
| |
| Publicado el 19,marzo 2016 - 11:25 |
Hi Dann, here is the type of code I use (NO UML and NO Classes)
ST_sSales is Structure ontheRoad_GUID is string OntheRoad_Seq is int ....... END
// Same thing for ST_sSalesFinance and ST_sSalesProducts structure //
// this is the structure sent// // notice nCounter - its just a STUPID DUMMY// // it won't work if you don't have one !!!//
ST_PostSales is Structure nCounter is int arrMySales is array of ST_sSales arrMySalesFinance is array of ST_sSalesFinance arrMySalesProducts is array of ST_sSalesProducts END
// actual code to send to WEB Service // nDummyScript is int=0 mySendResult is int bufPost is Buffer
// fill in the ST_PostSales //
myPostSales is ST_PostSales myPostSales.nCounter=77 // only ONCE at the beginning
// IN somekind of LOOP / QUERY ? nDummyScript=ArrayAdd(myPostSales.arrMySales) myPostSales.arrMySales[nDummyScript].ontheRoad_GUID = your data myPostSales.arrMySales[nDummyScript].OntheRoad_Seq = your data .............. // END of LOOP
// Same code above for ST_sSalesFinance and ST_sSalesProducts structure
// now serialize and send it ...
Serialize(myPostSales, bufPost, psdJSON) mySendResult=Sales_Import(gnCurrentOntheRoad_Seq,bufPost) RESULT mySendResult
// Sales_Import is the procedure on the WEB Service /// |
| |
| |
| | | |
|
| | |
| |
| Publicado el 19,marzo 2016 - 11:59 |
Hi Steven,
if you don´t use UML, how do you manage database / query fields modification ? (new fields, rename, deletion ?) Why do you use "psdJSON" and not "binary" (it´s faster because less size) ? |
| |
| |
| | | |
|
| | |
| |
| Publicado el 19,marzo 2016 - 12:33 |
Hi Michael, I think that it is more appropriate - when teaching WD techniques - to use straight procedural code. If you understand the "underlying procedural code" it is easy - if you like - to go to UML, classes etc.
(1) I use this kind of code in my applications: ST_OrderLines is Structure r_OrderLine is Record of OrderLine END
So ST_OrderLines and r_OrderLine is always in (some way) inSynch with my database. I never have to do any kind of UML regenaration etc ... Except of course when I change/delete field names. The debugger catches these problems and I fix them
(2) I always like to be at the PHYSICAL LEVEL of my database. I don't like CONCEPTUAL MODELS Probably the way my brain was trained all these years 
(3) I also use BINARY (most of the time) - it is faster. But I have found situations where a 3rd party couldn't consume it with .NET/Java apps.
Steven Sitas |
| |
| |
| | | |
|
| | |
| |
| Publicado el 19,marzo 2016 - 13:05 |
Hi Steven,
(1) If I´m not wrong I think the record variable doesn´t work with queries. How do you handle this ? |
| |
| |
| | | |
|
| | |
| |
| Publicado el 19,marzo 2016 - 13:23 |
Hi Michael, I mostly use SQL code for the queries -so I/ or the users construct them on the fly. The only problem with Records is that they are not directly available in browser code, in WebDev.
Steven Sitas |
| |
| |
| | | |
|
| | |