Record in a report

Navi_Learner
Member Posts: 356
I have a problem in retrieving a field in a report. I create a report on several tables. I create some variables, one of which is SalesCredit with data type Record.
Here is my code:
In the OnAfterGetRecord of Return Order
SalesCredit.SETFILTER("Return Order No.", "Return Order"."No.");
IF SalesCredit.FIND('-') THEN BEGIN
"Return Order"."No." := SalesCredit."Return Order No.";
END;
The Sales Credit No. in all records is PS10001 when I retrieve the report.
Does anyone why my code doesn't work? Thanks in advance!
Here is my code:
In the OnAfterGetRecord of Return Order
SalesCredit.SETFILTER("Return Order No.", "Return Order"."No.");
IF SalesCredit.FIND('-') THEN BEGIN
"Return Order"."No." := SalesCredit."Return Order No.";
END;
The Sales Credit No. in all records is PS10001 when I retrieve the report.
Does anyone why my code doesn't work? Thanks in advance!
0
Comments
-
Change the code:
SalesCredit.SETFILTER("Return Order No.", "Return Order"."No.");
IF SalesCredit.FIND('-') THEN BEGIN
"Return Order"."No." := SalesCredit."Return Order No.";
END ELSE BEGIN
"Return Order"."No." := '';
END;
The variable "Return Order"."No." was not being reset.0 -
Also I would use instead of
//old
SalesCredit.SETFILTER("Return Order No.", "Return Order"."No.");
//new
SalesCredit.SETRANGE("Return Order No.", "Return Order"."No.");0 -
No, it doesn't work either0
-
Could you tell me what you are printing on the report? what is the source expression of the textbox in body section? I would create a text varialbe instead of assigning it to ReturnOrderNo.
here is how I would do it.
onaftergetrecord()
MyReturnNo := '';
SalesCredit.setrange("Return Order No.", "Return Order"."No.");
IF SalesCredit.FIND('-') THEN
MyReturnNo := SalesCredit."Return Order No.";
add to the body section a text box with sourcexp MyReturnNo.0 -
But why there's extra line of record displaying the first Record, Here's the output:
Customer ID Return No.
PS10001
RED01 PS10001
SUN02 PS100110 -
But why there's extra line of record displaying the first Record, Here's the output:
Customer ID Return No.
PS10001
RED01 PS10001
SUN02 PS100110 -
You might have a customer with customer no. Blank?0
-
SOlVED! Thanks! Regarding the same report, I create another two variables with Date type RECORD. One is CreditLineTable which is Sales Cr. Memo Line and the other one is CreditTable which is Sales Cr. Memo Header and the other two variables: CreditItem and CreditQuantity. I want to retrieve the Item and quantity from Sales Cr. Memo Line. I make full use of the code you sent to me before. Here is the code:
CreditItem :='' ;
CreditLineTable.SETFILTER("Document No.", SalesCreditTable."No.");
IF CreditLineTable.FIND('-') THEN BEGIN
CreditItem := CreditLineTable."No." ;
END;
CreditQuantity := 0 ;
CreditLineTable.SETFILTER("Document No.", SalesCreditTable."No.");
IF CreditLineTable.FIND('-') THEN BEGIN
CreditItem := CreditLineTable."Quantity." ;
END;
The First record just get one item and the rest of the records are repeated one item from the other record. Can you expert point it out? Thanks!0 -
you code can be run this way as well.
CreditItem :='' ;
CreditQuantity := 0 ;
CreditLineTable.SETRANGE("Document No.", SalesCreditTable."No.");
IF CreditLineTable.FIND('-') THEN BEGIN
CreditItem := CreditLineTable."No." ;
CreditItem := CreditLineTable."Quantity." ;
END;
I don't understand what you are looking for. there could be many sales credit line for a credit memo header. Do you want to print all the items? If yes then, you need to have two dataitems
Sales Cr. Header
-->Sales Cr. Line
Link them and in body section display the appropriete fields0 -
Thanks! Actually I create a report based on Return Header and Return line tables which I recently created. I can connect either return Header or Return Line with Sales Cr. Memo Header as they all have RA#, but in Sales Cr. Memo Line I can't retrieve any data since there's no relationship between Return Header or Return line, but Credit No links Sales Cr. Memo Header together with Sales Cr. Memo Line. That's why I create the two variables with record data type. I need my report like this:
RA# Return Item Return Quantity
R10001 AC01 10
R10002 SD03 15
What's the problem of my code? Do I have to write something about Return Header to link the data? Thanks0 -
ara3n wrote:Also I would use instead of
//old
SalesCredit.SETFILTER("Return Order No.", "Return Order"."No.");
//new
SalesCredit.SETRANGE("Return Order No.", "Return Order"."No.");Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!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