woodsdarren 10/17/2012 2:16:56 PM

VS Tools Dex Ranges

Hi,

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?

 

Thanks,

Darren

 

 

// Set Reference to AR Apply Table
RmAppliedOpenTable rmApplyOpenTable = Dynamics.Tables.RmAppliedOpen;
try
 {
      //Set Table Key
      rmApplyOpenTable.Key = 2;
 
     //Start of Range
    rmApplyOpenTable.Clear();
    rmApplyOpenTable.ApplyToDocumentNumber.Value = 12345;
    rmApplyOpenTable.ApplyToDocumentType.Value = 1;
    rmApplyOpenTable.RangeStart();
 
    // End of the range
    rmApplyOpenTable.Fill();
   rmApplyOpenTable.ApplyToDocumentNumber.Value = 12345;
    rmApplyOpenTable.ApplyToDocumentType.Value = 1;
    rmApplyOpenTable.RangeEnd();
 
    //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;
           }
           else
           {
                 applies += ", " +  rmApplyOpen.ApplyFromDocumentNumber.value;
           }                   
          
         //Get the next line item
          err = rmApplyOpenTable.GetNext();
       }
 
return applies;
rmApplyOpen.close();

 

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


Table Definition Quick Links
All Tables
SOP Tables
RM Tables
GL Tables
POP Tables
HR Tables
PM Tables
UPR Tables
IV Tables
Olympic Tables
3