Copyfilters from Dataitem to record Variable

sunnyk
Member Posts: 280
hi All,
i have one small doubt in copyfilters. I have 2 dataitems namely Vendor and Purch. Rcpt Line(Indented under Vendor). I made one Variable PurchRcptLine and i want to use that in vendor OnAfterGetRecord(). But i want that it should take all the filters which user give at the request form on Purch. Rcpt Line tab. So i used, PurchRcptLine.copyfilters(Purch. Rcpt Line).
IS that ok? for me i think its not working that why i put this query here?
i have one small doubt in copyfilters. I have 2 dataitems namely Vendor and Purch. Rcpt Line(Indented under Vendor). I made one Variable PurchRcptLine and i want to use that in vendor OnAfterGetRecord(). But i want that it should take all the filters which user give at the request form on Purch. Rcpt Line tab. So i used, PurchRcptLine.copyfilters(Purch. Rcpt Line).
IS that ok? for me i think its not working that why i put this query here?
0
Comments
-
Good morning,
try this:Report - OnPreReport() PurchRcptLine.copyfilters(Purch. Rcpt Line);
Item - OnPreDataItem() error('The filters are = %1',PurchRcptLine.getfilters);
RegardsDo you make it right, it works too!0 -
HI Garak,
I tried to copyfilters on On PreDataitem(first Dataitem) or OnAfterGetrecord(first Dataitem) but thr its not working.
Lets say i have Vendor as my first dataitem and Purch Lines as indented Dataitem. i made one variable PurchLine. at the onPreDataItem of vendor if i write PurchLine.copyfilters(Purch Line) than i am getting nothing.0 -
That's because your indented DataItem isn't really initialized at this point. Maybe you could move your to OnPreDataItem of your indented DataItem, but your filters set by DataItemLink won't be copied anyway."Money is likewise the greatest chance and the greatest scourge of mankind."0
-
other people's suggestions are correct, but i 2 more things to add (just for info):
1. If you set a filter by code on a dataitem before the onpredataitem trigger of that dataitem, the filters will be lost (as einstein said, the variable is re-initialized at "onpredataitem time")
2. You can probably copy the filters of the dataitemlink property by using filtergroup(4), but i've never tried it...i wonder if it works, it should :whistle:0 -
Belias wrote:2. You can probably copy the filters of the dataitemlink property by using filtergroup(4), but i've never tried it...i wonder if it works, it should :whistle:"Money is likewise the greatest chance and the greatest scourge of mankind."0
-
For occasional readers: i'm just guessing, don't take this statement as it is true
i don't have time to try, but probably code like this should work, as filtergroups should isolate the filters: :-ka.copyfilters(b); filtergroup(4); a.copyfilters(b);
0 -
Belias wrote:1. If you set a filter by code on a dataitem before the onpredataitem trigger of that dataitem, the filters will be lost (as einstein said, the variable is re-initialized at "onpredataitem time")
:whistle:Belias wrote:2. You can probably copy the filters of the dataitemlink property by using filtergroup(4), but i've never tried it...i wonder if it works, it should :whistle:
when i am using filtergroup(4) it does remove all filters like if i say just.
onprereport trigger
a.copyfilters(b);
i got filters
filtergroup(4);
a.copyfilters(b); after this nothing..0 -
einsTeIn.NET wrote:Belias wrote:2. You can probably copy the filters of the dataitemlink property by using filtergroup(4), but i've never tried it...i wonder if it works, it should :whistle:
yes it's working when i checked it on onpredataitem trigger of under indented dataitem.
but it's giving only dataitemlink filters even i have assign other filters at run time(before preivew).
i think it does work only for dataitemlink filters..0 -
dataitem link filters are known before runtime: maybe you can try to use GETFILTER (singular) only on the fields you want :-k
Sorry guys for just posting my thoughts without checking them...i'm as curious as busy up to now0 -
I tested it, it works. Calling COPYFILTERS a second time doesn't remove the previous set filters, but it looks like because COPYFILTERS does also copy the filtergroup.
This code should be placed in the OnPreDataItem of "Purch. Rcpt. Line".// this will copy all filters set by the user PurchRcptLine.COPYFILTERS("Purch. Rcpt. Line"); // this will set the filtergroup to the level of DataItemLink FILTERGROUP(4); // this will copy all filters set by DataItemLink and also set the filtergroup of PurchRcptLine to 4 PurchRcptLine.COPYFILTERS("Purch. Rcpt. Line"); // might be necessary if you want to display all filters set by the user PurchRcptLine.FILTERGROUP(0);
"Money is likewise the greatest chance and the greatest scourge of mankind."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