SETSELECTIONFILTER sends empty record

alex88
Member Posts: 4
I'm using Dynamics nav 2009 R2. I have 2 forms Clients and Invoice Header.
In my Invoice Header table i have a field named "Clientid" and "payment date".
Right now i have this code on my ClientId OnAfterValidate() trigger
And on my payment date field i have a CodeUnit on the OnActivate() trigger with the following code.
And here the code in the CodeUnit is
When i pick a ClientId a message shows the right ClientId number but when i go the payment date its just show 0.
In my Invoice Header table i have a field named "Clientid" and "payment date".
Right now i have this code on my ClientId OnAfterValidate() trigger
InvoiceHeaderFacturatie.GET; MESSAGE(FORMAT(ClientId)); CurrForm.SETSELECTIONFILTER(InvoiceHeaderFacturatie);
And on my payment date field i have a CodeUnit on the OnActivate() trigger with the following code.
PaymentDate.PDTable(InvoiceHeaderFacturatie);
And here the code in the CodeUnit is
MESSAGE(FORMAT(pInvoiceHeaderFacturatie.ClientId));
When i pick a ClientId a message shows the right ClientId number but when i go the payment date its just show 0.
0
Answers
-
Hi Alex
SETSELECTIONFILTER sets a filter such that when you iterate over the record, you will visit all records that were selected in the form. It does not alter any fields.
Try this code in your CodeunitIF pInvoiceHeaderFacturatie.FINDSET THEN REPEAT MESSAGE(FORMAT(pInvoiceHeaderFacturatie.ClientId)); UNTIL pInvoiceHeaderFacturatie.NEXT = 0;
If you intended to get the current record only trypInvoiceHeaderFacturatie := Rec;
Btw. what isInvoiceHeaderFacturatie.GET;
supposed to do? If this is a setup table with only one record, SETSELECTIONFILTER does not make any sense at all, otherwise the GET without any primary key values probably does not make much sense.0 -
SETSELECTIONFILTER works on how much record set you have selected.Thanks
Blog - rockwithnav.wordpress.com/
Twitter - https://twitter.com/RockwithNav
Facebook - https://facebook.com/rockwithnav/0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions