|
| How to Store Structure Variable into table |
| Iniciado por guest, 09,nov. 2016 09:06 - 3 respuestas |
| |
| | | |
|
| |
| Publicado el 09,noviembre 2016 - 09:06 |
Hello All,
I have defined a variable structure in WD21 as ffs;
MyStruct is Structure Fld1 is string Fld2 is Int Fld3 is Numeric END
WorkStruct is MyStruct
Assignments go like this WorkStruct: Fld1="name_of_person" WorkStruct: Fld2=3 WorkStrcut:Fld3=1843.29
If I have done about 50 assignments as per above, is there a way I can save to a table/file if the 'Fld"s are the same as found in the table?
I am looking at something similar to HCopyRecord
Any other way to do this would also be appreciated.
Sam |
| |
| |
| | | |
|
| | |
| |
| Publicado el 09,noviembre 2016 - 10:51 |
Hi,
Yes this is possible using GetDefinition of the structure, looping through all elements of the structure and assigning them via indirection to the record fields.
Don't forget to do the assignment in a 'WHEN EXCEPTION' block resetting exception handling using ExceptionEnable() whenever the assignment failed. This is like a 'try' block in Java or .Net.
Alternative to a structure you could use a class with the record structure defined as members. Here, you can use 'FileToMemory' and 'MemoryToFile' to auto-assign matching field names. On top of that you can declare even members with their own names and use the 'mapping' keyword to assign it to a specific field in a table.
Cheers,
Peter Holemans |
| |
| |
| | | |
|
| | |
| |
| Publicado el 09,noviembre 2016 - 12:37 |
Thanks Peter. I would have a go at it.
I do appreciate it.
Sam. |
| |
| |
| | | |
|
| | |
| |
| Publicado el 09,noviembre 2016 - 17:58 |
Sam
If going down the 'mapping' option as suggested by PH the make yourself a quick project and create a Form and Window (in that order) from the MVP RAD option.
If you have WD v20 then there are examples already available.
t.b.h. not all of it works as it should straight out of the box but the principles are all there if you study the classes that are created. Only operational for WD unfortunately. |
| |
| |
| | | |
|
| | | | |
| | |
|