DatasetModel Class - GetFirst...Do I need
 
Forums / SmartComponent Library - Developer Forum / DatasetModel Class - GetFirst...Do I need

DatasetModel Class - GetFirst...Do I need

1 posts, 0 answered
  1. Roger Blanchard
    Roger Blanchard avatar
    413 posts
    Registered:
    29 Jun 2018
    18 Sep 2019
    Link to this post
    In the code below if I do not use the GetFirst on the DatasetModel class my first record will appear twice in my loop. Should I need to do this? It does work but I was not expecting to have to use GetFirst before my loop.

    DEFINE VARIABLE oRebateCustomer  AS Osprey.Pos.RebateCustomer.RebateCustomerDatasetModel  NO-UNDO.


    oRebateCustomer = NEW Osprey.Pos.RebateCustomer.RebateCustomerDatasetModel ().
    oRebateCustomer:RetrieveData("eRebateCustomer,eEcoupon",
                                                  "FOR EACH eRebateCustomer WHERE eRebateCustomer.CustomerNum = 244001" + CHR(1) +
                                                  "FOR EACH eEcoupon WHERE eEcoupon.IsUsed = TRUE"
                                 ).
                                
    oRebateCustomer:UseDatasetQueries().
    /* Roger Blanchard / Osprey Retail Systems Sep 18, 2019
     If I do not use GetFirst then the first record will be duplicated
     in my loop below
    */
    oRebateCustomer:RebateCustomer:GetFirst().
    DO WHILE oRebateCustomer:RebateCustomer:Available:
     
     MESSAGE
      "oRebateCustomer:RebateCustomer:CustomerNum=" oRebateCustomer:RebateCustomer:CustomerNum  SKIP
      "oRebateCustomer:RebateCustomer:RebateId=" oRebateCustomer:RebateCustomer:RebateId  SKIP
     VIEW-AS ALERT-BOX.

     oRebateCustomer:RebateCustomer:GetNext(). 
     
    END.    
    FINALLY:
     DELETE OBJECT oRebateCustomer NO-ERROR.    
    END FINALLY.      
1 posts, 0 answered