Announcements
I have this code that loops through the GL Inquiry scroll window. I just happened to stumble across a recurring GL entry the is posted each month. The entries consists of 3 distribution lines. What makes each posting unique is the date and RecurringTrxSequence. So I pass all these values down and set the beginning and ending range but much to my surprise the loop goes through all 36 distributions crossing dates. I am using key 8 which matches these values. On the screen is only the three for each month. What am I missing to restrict it to just the three distributions for each date?
Microsoft.Dexterity.Applications.DynamicsDictionary.GlYtdTrxOpenTable GLDistTable;
GLDistTable = Dynamics.Tables.GlYtdTrxOpen;
GLDistTable.Key = 8;
GLDistTable.RangeClear();
GLDistTable.Clear();
GLDistTable.JournalEntry.Value = JournalNumber;
GLDistTable.OpenYear.Value = TrxYear;
GLDistTable.TrxDate.Value = TrxDate;
GLDistTable.RecurringTrxSequence.Value = RecurringTrxSequence;
GLDistTable.RangeStart();
GLDistTable.Fill();
GLDistTable.JournalEntry.Value = JournalNumber;
GLDistTable.OpenYear.Value = TrxYear;
GLDistTable.TrxDate.Value = TrxDate;
GLDistTable.RecurringTrxSequence.Value = RecurringTrxSequence;
GLDistTable.RangeEnd();
err = GLDistTable.GetFirst();
while (err != TableError.EndOfTable)
{
Do work
}
Wow, talk about needing to take a break. Right there in my notes I wrote down index 10 yet somehow in my code it is 8. Thanks for a second set of eyes.
When you set an indexed range you must populate the fields for the key you are using. Looking at the fields you are using, you should be using key 10 not key 8. See screenshot from GP Power Tools Resource Information.
GLDistTable.Key = 8;
Should by
GLDistTable.Key = 10;
André Arnaud de Cal... 291,359 Super User 2024 Season 2
Martin Dráb 230,370 Most Valuable Professional
nmaenpaa 101,156