- David Vasconcelos
- PowerBuilder
- Thursday, 25 June 2020 03:46 PM UTC
Looking for some ideas for an issue regarding saving and events that are posted in the itemchanged event.
Simple Scenario...
Datawindow has a date field, the date entered must only be a business date. User enters a date, post event fires (this is because the date entered must be accepted by the datawindow in order for it to be adjusted later by the posted code since you cannot change the data within the itemchanged event), posted code checks the date to see if its a business date, if it is not it will adjust the date for the user to the next available business date. I.E. user enters June 13, which is a Saturday, not a business day so code will automatically adjust it to be Jun 15 which is the Monday and is a business day. All this occurs in a post event and then Sets the field with the new date.
Issue.
User has not moved off the field so the itemchanged has not fired off yet.
User then hits save which runs , accept text (itemchanged and post happens), validation functions then checks for all good return codes then does the save and checks for save return codes. So when the accepttext fires off and the itemchanged event posts the routine to check the date, validation functions will fire off but won't have the new date since that code has been posted. Save fires off but saves the entered data since the posted code has not fired off yet.
Can't post the save since you need to look for return codes for success or not to be able to run any code after the save. i.e. Post save...
Interested in reading what others have done.
Thanks
Dave V.
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.