Mike Fechner
375 posts
Registered:
14 Sep 2016
Answered
20 Nov 2018
in reply to
Roger Blanchard
Link to this post
I typically solve those requirements by adding a second editor-button with a "clear" function.
Injecting an empty record is something I have never tried.
I would expect that the AfterInitializeBusinessEntityAdapter event is too early. As the RetrieveData is called after that. However in that event you are receiving the reference to the actual SmartBusinessEntityAdapter. I would actually try to solve this on the backend - use the AfterInitializeBusinessEntityAdapter event to set the Business Entity Adapter's "CustomContext" property to a value like "IncludeFlagValue". Then in the Business Entities's override of the FetchData() method (the one with the IFetchDataRequest parameter), do the
SUPER:FetchData (poFetchDataRequest) .
and then
IF poFetchDataRequest:CustomContext = "IncludeFlagValue" THEN DO:
/* create the extra record */
END.
There may be complications with batching that require fine tuning though. Is it o.k. to set the BatchSize to 0 ?
For small sets of data, I'd go with the SmartComboEditor instead. This supports a "flag" value which is typically either the "none" or "all" kind of entry.