Roger Blanchard
447 posts
Registered:
29 Jun 2018
15 Feb 2019
Link to this post
I am trying to use the DatasetModelMode of Disconnected. I have created a BE defined with TT that are not bound to the DB. I want to use the DatasetModel class on the client to create TT records. I then want to call Savechanges where I will OVERRIDE the default handling to save the dataset on the client.
The following code seems to create TT records. However, after the final create if I try to loop through the records there are none. Do I need to call Savechanges for each TT record being created? I did try that and get errors.
I must be missing something. I did review SCL-1768 and updated my datasetmodel.template and then recreated my dataset model class.
DEFINE VARIABLE oEJournal AS Osprey.PointOfSale.EJournal.EJournalDatasetModel NO-UNDO.
oEJournal = NEW Osprey.PointOfSale.EJournal.EJournalDatasetModel (DatasetModelModeEnum:Disconnected). // disconnected mode
oEJournal:EJournal:Create().
oEJournal:EJournal:RecNum = 1.
oEJournal:EJournal:RecType = "98".
MESSAGE
oEJournal:EJournal:RecNum SKIP
oEJournal:EJournal:RecType
VIEW-AS ALERT-BOX.
oEJournal:EJournal:Create().
oEJournal:EJournal:RecNum = 2.
oEJournal:EJournal:RecType = "1".
oEJournal:EJournal:GetFirst().
DO WHILE oEJournal:EJournal:Available:
MESSAGE
oEJournal:EJournal:RecNum SKIP
oEJournal:EJournal:RecType
VIEW-AS ALERT-BOX.
oEJournal:EJournal:GetNext().
END.
MESSAGE
"Before Savechanges" SKIP
VIEW-AS ALERT-BOX.
oEJournal:SaveChanges().
MESSAGE
"After Savechanges" SKIP
VIEW-AS ALERT-BOX.
CATCH e AS Progress.Lang.Error:
ErrorHelper:ShowErrorMessage(e).
END CATCH.