Sign Up Now!Log In
woodsdarren 10/17/2012 2:16:56 PM

VS Tools Dex Ranges


I am trying to get all apply records for a certain document number, document type combination.  I have followed the VS Tools Programmers guide for Multi-segment keys and have the following code.  The issue is that the string contains all apply records.  Ones with different customers and ones that do not have an apply to document number of 12345.  Can someone see what I am doing wrong?






// Set Reference to AR Apply Table
RmAppliedOpenTable rmApplyOpenTable = Dynamics.Tables.RmAppliedOpen;
      //Set Table Key
      rmApplyOpenTable.Key = 2;
     //Start of Range
    rmApplyOpenTable.ApplyToDocumentNumber.Value = 12345;
    rmApplyOpenTable.ApplyToDocumentType.Value = 1;
    // End of the range
   rmApplyOpenTable.ApplyToDocumentNumber.Value = 12345;
    rmApplyOpenTable.ApplyToDocumentType.Value = 1;
    //Read through all of the rows in the range
    err = rmApplyOpenTable.GetFirst();
   string applies = "";
int i =0;
    while (err == TableError.NoError)
           if (i == 0)
               applies += rmApplyOpen.ApplyFromDocumentNumber.value;
                 applies += ", " +  rmApplyOpen.ApplyFromDocumentNumber.value;
         //Get the next line item
          err = rmApplyOpenTable.GetNext();
return applies;


Version: GP 2010
Section: Visual Studio Tools for Dynamics GP