Reports: Preventing a DataItem from running

PaLPiTaTioN
Member Posts: 55
Hi,
I have a report structure like
On the Request Form, I created a checkbox to let the user choose if he wants to see the records from Cust. Ledger Entry. This means that I should be able to prevent the Cust. Ledger Entry-dataitem from running at all.
I could use SKIP in OnAfterGetRecord, which would work, but would take lots of time. I could also use SetFilter in OnPreDataItem of Customer to make the recordset to skip less, which would make it all faster. But I cannot find the way to use OnPreDataItem (or the OnAfterGetRecord of the Customer table) to cancel the execution of the Ledger Entries dataitem.
does anyone know what I should do? SKIP and BREAK don't seem to do it.
I have a report structure like
customer cust. ledger entry
On the Request Form, I created a checkbox to let the user choose if he wants to see the records from Cust. Ledger Entry. This means that I should be able to prevent the Cust. Ledger Entry-dataitem from running at all.
I could use SKIP in OnAfterGetRecord, which would work, but would take lots of time. I could also use SetFilter in OnPreDataItem of Customer to make the recordset to skip less, which would make it all faster. But I cannot find the way to use OnPreDataItem (or the OnAfterGetRecord of the Customer table) to cancel the execution of the Ledger Entries dataitem.
does anyone know what I should do? SKIP and BREAK don't seem to do it.
0
Comments
-
Try put the BREAK command on the PreDataItem of the Cust Ledg EntryThis isn't a signature, I type this at the bottom of every message0
-
PaLPiTaTioN wrote:SKIP and BREAK don't seem to do it.SteveO wrote:Try put the BREAK command on the PreDataItem of the Cust Ledg Entry
It doesn't work.0 -
I would:
1. Create one section (body or group section, depending on what you want to do) on the report that has the Cust. Ledger Entry fields you want to display.
2. Create one section of the same type that does not contain the Cust. Ledger entry fields.
3. Use the CurrReport.SHOWOUTPUT(chkBoxVal) on the sections to determine which section shows up.
If the checkbox is TRUE, the section will print. If it is FALSE, the section will not print.
I do this all the time to suppress printing of data depending on user needs.
Hope this helps.0 -
My problem isn't showing or not showing data. I could simply prevent the data from being outputted with the CurrReport.SKIP in OnAfterGetRecord. The issue is performance, because if I use SKIP, all records are evaluated, which takes a lot more time than just skipping a whole data item.0
-
I have made the following report:
Customer
Customer Ledger Entry (Linked by customer no = customer.no)
I have the following variable
skipcle : BOOLEAN
on Customer Ledger Entry.PreDataItem I have the following
if skipcle then
CurrReport.BREAK;
I have 2 bodies
Customer.BODY: Displays No. and Name
Customer Ledger Entry.BODY: Displays Entry No.
when skipcle = FALSE
I see all cle linked to the correct customers
when skipcle = TRUE
I only see customer no and name, no customer ledger entriesThis isn't a signature, I type this at the bottom of every message0 -
I have tried this in both 3.7 and 2.01A and both worked exactly the same.
The BREAK seems to work just fineThis isn't a signature, I type this at the bottom of every message0 -
PaLPiTaTioN wrote:Hi,
I have a report structure likecustomer cust. ledger entry
On the Request Form, I created a checkbox to let the user choose if he wants to see the records from Cust. Ledger Entry. This means that I should be able to prevent the Cust. Ledger Entry-dataitem from running at all.
I could use SKIP in OnAfterGetRecord, which would work, but would take lots of time. I could also use SetFilter in OnPreDataItem of Customer to make the recordset to skip less, which would make it all faster. But I cannot find the way to use OnPreDataItem (or the OnAfterGetRecord of the Customer table) to cancel the execution of the Ledger Entries dataitem.
does anyone know what I should do? SKIP and BREAK don't seem to do it.
of PreDataItem of the cust. ledger entry, you could add the following codes.
IF SkipDetails then "Cust. Ledger Entry".SETRANGE("Entry No.",0)
This way, the system will not enter into the Ledger Entry DataItem since there will be none there anyway.
Where SkipDetails is a Boolean Variable that you have placed on the Request Options Form of the Report.
NB: PrintOnlyIfDetail Property of the Customer DataItem MUST be set to NO Before This Works.Sunday, Godwin G0 -
In the C/AL Globals create a boolean with the name "ShowDetails"
In the Request Form Designer create a checkbox with the label "Show Details".
In the properties window of the checkbox insert the value for the property SourceExp=ShowDetails.
In the Section Designer select the Customer Ledger Body and open the C/AL Editor.
In the OnPreSection Trigger put the following code:
CurrReport.SHOWOUTPUT(ShowDetails);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