DatasetModelModeEnum:Disconnected
 
Forums / SmartComponent Library - Developer Forum / DatasetModelModeEnum:Disconnected

DatasetModelModeEnum:Disconnected

4 posts, 0 answered
  1. Roger Blanchard
    Roger Blanchard avatar
    381 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.         
  2. Mike Fechner
    Mike Fechner avatar
    319 posts
    Registered:
    14 Sep 2016
    18 Feb 2019 in reply to Roger Blanchard
    Link to this post
    Hi Roger,

    try calling 

    oEJournal:EJournal:QueryOpen().  

    before 

    oEJournal:EJournal:GetFirst(). 
  3. Roger Blanchard
    Roger Blanchard avatar
    381 posts
    Registered:
    29 Jun 2018
    18 Feb 2019 in reply to Mike Fechner
    Link to this post
    thanks mike, I will give that a try.
  4. Roger Blanchard
    Roger Blanchard avatar
    381 posts
    Registered:
    29 Jun 2018
    19 Feb 2019 in reply to Mike Fechner
    Link to this post
    Mike,

    That did not work either. So, I went back and tried generating the classes again under the Generate tab. I noticed that these classes were generated in the backend project instead of shared. I think the wrong code was being used.

    If I first "Generate" under the Business entity tab the TT/DS include files are generated in the shared project. If I then "Generate classes" under the "Generate" tab the classes are then created in the shared project. Once I did that these new generated classes do seem to work.

    Thanks.



4 posts, 0 answered