Structs and data-caching.
Author: firstname.lastname@example.org (Iain Sharp)
Okay, so I am trying to play with structs to get around some problems I have. We have a component with a complex function within it to calculate the best stocks to use to produce cut pieces. I want to be able to execute this procedure, but allow the user to revert to the previous 'stored' value if they determine they don't like the current one. I was using xmlsave, but this requires a lot of coding to ensure the DTD matches the component structure. So, having upgraded to 9.5, I thought of structs. However, I am unsure how to handle this properly. I tried, (where old_optimise is a modeled non-database xmlstream, ) variables struct v_struct endvariables Componenttostruct v_struct structtoxml old_optimise, v_struct with the plan of restoring the current position using xmltostruct v_struct, old_optimise clear structtocomponent v_struct But this crashes uniface on the structtoxml. I am trying to make the recovery 'recursive' in that the user can optimise, optimise, optimise, and then back out undoing each one at a time, until they save to the database. (which is why I am trying to save the data in a field in the model, so the next optimise backs up the backup. ) Without the 'recursion' I tried using a component variable. This seems to work, but all the fields and occurrences are set to validate by structtocomponent. Are there any worked examples of caching the contents of a component I am not finding in the help?