Adding a field from Vendor card to purhcase header

I’m trying to add the “Our Account No.” field from the vendor card to the purchase header so that it will print on the purchase order report… I tried a flow field but that is not working as it is only pulling the account no. from the first listed vendor. Is a flow field not the way to go? Do I need to write some code? Any ideas would be appreicated…running NAV 4.0 SP3 SQL.

FlowField is fine, but you have not set up the field correctly. When defining your CalcFormula you need to setup a link between the vendor on the order and the vendor card. If you cannot figure it out I will try and point you further in the right direction.

Thanks for the reply Max. That is where my problem is. Here is my current calc formula

Lookup(Vendor.“Our Account No.” WHERE (Our Account No.=FIELD(FILTER(LSI Account #))))

Let me know what additions/changes I need to make.

If you want to show it in Purchase Order form, you can get “Our Account No.” value in report only like

Vendor.SETRANGE(“No.”,“Buy-from Vendor No.”);

and you can show Vendor.“Our Account No.” in any text box…

You need to link the FlowField with the specific Vendor in the Table Filter of the CalcFormula.

Something like this:

Field Type Value
No. FIELD Buy-from Vendor No.

Thanks, Thomas…that worked…having an issue displaying it now on the report itself…it is coming over to the purchase header no problem…i checked the properties of the field and it looks like it should be displayed no problem…any thoughts on that?

You have to do a CALCFIELDS in your report. This is automatically done on forms for you, but not in reports.

matt…what should that code look like for the calcfields

Did you look up CALCFIELDS in the NAV help menu? It will tell you the exact syntax for how to use it. You’ll want to place it in the OnAfterGetRecord trigger so that it has some data to work with.

Got it. Thanks for the help Matt…works perfectly.

if you just need it on a report I would use

Onaftergetrecord of the purch header

vendor.get(“Buy-From Vendor No.”);
MyAccountNo := vendor.“our account no.”;

MyAccountno is a var type (text size20) which would also be the sourceexp of my textbox.

FYI.It doesn’t need to be on the purchase header to show in the report.

Even, if you want to add the field on Purchase header, why to use Flowfield(lookup [*-)])?

In Table 38 - Buy-from Vendor No. - OnValidate() trigger

After the below Code

“Buy-from Country/Region Code” := Vend.“Country/Region Code”;


“My Account No.” := Vend.“My Account No.”; // New Code