How get the filter from a dataitem
DarkHorse
Member Posts: 389
Dear folks, I'd like to know how do this. I've a report with 4 dataitems, in groups of two, I mean that they are in the same report but works different and doesn't are linked between them, I execute one or the other clicking the option on the request form and, in sections, I show it or hide.
But now I want that when I filter by "Order Date" on first Dataitem, the third dataitem gets also the filter that I put (this dataitem also has the "Order Date" field). How can I do that?.
Thanks.
But now I want that when I filter by "Order Date" on first Dataitem, the third dataitem gets also the filter that I put (this dataitem also has the "Order Date" field). How can I do that?.
Thanks.
0
Comments
-
Lookup the GETFILTER method. It works on a record and you supply it a field as a parameter. It will return the filter string on that field.0
-
Thanks, but where put the code, Onaftergetrecord (I think)? I had try putting
Var1:= "Purch. Rcpt. Header".GETFILTER("Order Date"); but it doesn't work. Can you put me an example if you're so kind?
Thanks in advance.0 -
Hi,
To get the filter on first table:
On PreReport Trigger:
Rec1.GETFILTER("Order Date");
For applying this filter to 2nd table:
On PreReport Trigger:
Rec2.CopyFilter("Order Date",Rec1."Order Date");
Hope this helps-Dhan Raj Bansal
Linkedin Profile: http://in.linkedin.com/in/dhanrajbansal0 -
For applying this filter to 2nd table:
On PreReport Trigger:
Rec2.CopyFilter("Order Date",Rec1."Order Date");
To apply the filter you need to apply it in OnPreDataItem not in OnPreReport, else it would be reset in OnPreDataItem... if I remmember correctly0 -
Yes Kine, you are right...my mistake-Dhan Raj Bansal
Linkedin Profile: http://in.linkedin.com/in/dhanrajbansal0 -
Thanks for reply. Rec1 and Rec2 are variables or tables? if are varibles what kind?.
Thanks for help.0 -
They are variables representing the Data Items in your report...0
-
Thanks; I thinks there's a little problem. If I put onPredataitem from the first table
Rec1.GETFILTER("Order Date"); it says to me "Have to use the return value of this work" and stops after GETFILTER. Do you know what can be the problem, please?.
Thanks.0 -
Create a Variable Type Text - FilterString (250)
FilterString := Rec1.GETFILTER("Order Date");
Add a textbox to you report with SourceExp = Filterstring
If I remember correctly :-k
**Edit I guess I should have read the first post slower**On PreReport Trigger:
Rec2.CopyFilter("Order Date",Rec1."Order Date");0 -
Thanks for reply, now I can save the report but doesn't works, the second group of Dataitems don't filter buy the date. It's true that I don't put the code that you say:
Sorry, but I don't understand it, where and how I have to put it?.Add a textbox to you report with SourceExp = Filterstring
Thanks for help.0 -
What I thought you were looking for was to show the filter being used on the report. But I glanced instead of read your first post. You want to copy a filter to a different dataitem.
So filterstring gave you the return variable that the error message was looking for. If you added a textbox w/filterstring as it's sourceexp and put it in the header (for example) it would printout. that's all, that was about.
can you explain what you are doing on the second dataitem that isn't working?
Rec2.CopyFilter("Order Date",Rec1."Order Date"); did you try this?
Rec2.CopyFilter("Order Date",evaluate(filterstring)); perhaps? not tested
Each dataitem has it's own OnPreDataItem0 -
Thanks; I thinks it's all correct, but I'll see deeper all what you're saying to me.
Thanks for your help and time.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K 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
- 327 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


