Thought maybe I'd open a new topic for this. You might not have seen it since I posted it in an old topic of mine.
I have Nav 3.10. In the old topic you helped me add a Discount Comment to Customer Cards, that shows up on a Sales Header via FlowField. You can edit it on Customer Card, but only view it on Sales Orders. It does not print.
I'm not sure if my license allows it, but how would I get a field from Customer card to print on my Picking Sheet? I've created a new TextBox for "Invoice Instructions". I'd like to be able text into this field on the customer card and have it print out on the Picking Sheet.
0
Comments
RIS Plus, LLC
CALCFIELDS("Discount Comment");
The field name should match whatever the flowfield name of the field in the Sales Header is, e.g. if it is called DiscountCommentFromCustomerCard, then you would enter CALCFIELDS(DiscountCommentFromCustomerCard);
CALCFIELDS is used to trigger the calculation of a flowfield, which often is an arithmetic sum. In your case, it is just a "repeat" of information from the Customer table, but it still needs the CALCFIELDS command.
RIS Plus, LLC
Good clarification - I'm guessing that most beginning NAV programmers, when they first start creating objects, forget the CALCFIELDS a few times - at least I did <grin>...
RIS Plus, LLC
I went into Picking List and into C/AL Globals. Added Invoice Instructions with a DataType of Record with SubType Customer.
Added CALCFIELDS("Invoice Instructions") to OnAfterGetRecord.
On Picking List I created a TextBox, but what do I put for SourceExpr? ="Customer"."Invoice Instructions"? ="Sales Header"."Invoice Instructions"?
Anyway, If I try to compile it says "A field record variable was expected. For example: Record.Field Customer.Name" and it brings me to my OnAfterGetRecord section to fix whatever is wrong.
Your first post said you added a flowfield to the Sales Header called "Discount Comment". If all you wanted to do was display the "Discount Comment" on the Pick List, and your pick list already includes the "Sales Header" record as a dataitem (e.g. standard pick list report 10153), then in the "Sales Header" dataitem's "OnAfterGetRecord", you would add the line
CALCFIELDS("Discount Comment");
NOW...
If you're trying to add OTHER fields from the Customer Card OTHER than fields defined as flowfields on the Sales Header, you have to use a different technique - but it's not too difficult - you weren't too far off track on your last post - you were probably 90% right:
"I went into Picking List and into C/AL Globals. Added Invoice Instructions with a DataType of Record with SubType Customer."
It's a standard practice to create the global variable with a "logical name" of the actual record you're going to read. For me, I'd call the global variable "Customer" or "Cust", datatype Record, subtype "Customer" (you were right on the last two). Let's go with "Customer" for this example.
Then, in the "Sales Header" dataitem's "OnAfterGetRecord" trigger, insert the line:
Customer.GET("Sales Header"."Sell-to Customer No.");
This will read the customer record with the Customer Number matching the Sales Header record's "Sell-to Customer No.");
Now, after each Sales Header record is read, all the fields in the Customer Table are now available for printing.
Create the textbox in the report, and in the "SourceExpr" property, put
Customer."Invoice Instructions"
This assumes the field on the Customer table/card is called "Invoice Instructions"
Hope this helps.
Added C/AL Global called Customer. We already have one called Cust.
In sales Header we already have the following:
Cust.GET("Sell-to Customer No.");
It differs a little than what you wrote. But if I did try to enter what you wrote it won't compile, so I left yours out.
On the report I did try entering what you suggested. Which was Customer."Invoice Instructions".
It compiles fine, but nothing shows up.
Not 'Customer', not anything else, but 'Cust'. Remove all the new Customer variables and juse stick with the one already there, unless you have a need to get a customer that is not the Sell-to Customer on your order.
RIS Plus, LLC
What is the actual name of the field in the Customer table that you want to print? Find it in the table designer layout, e.g. it should be something like:
Field No. Field Name Data Type Length
50001 Invoice Instructions Text 250
Take a quick look.
Tools->Object Designer->Tables->Customer->Design
Look at the field you added to the table, "Invoice Instructions"
It's Type should be TEXT & it sounds like it's length is 30
http://www.BiloBeauty.com
http://www.autismspeaks.org
Just increase the field length to 80 or whatever you want.
Then, on the customer card, you may want to change the size and shape of the textbox with this field in it. Change the "Multiline" property to "Yes" and make the box "taller", and then your instructions will wrap within the box. Or, you can leave it the same size and the field will just "scroll" within the single-height textbox.
Where is that setting in a textbox? Unless you're talking about creating a global variable?
http://www.BiloBeauty.com
http://www.autismspeaks.org