I created a new report do show me the remaining sales orders. In this report I need the FlowField inventory field from table 27.
How can I show this FlowField in the sales line DataItem session?
I created this code in AfterRecord Sales Line Data Item, but the inventory result in 0
As the Inventory field is Flow Field, to display its value you should use CALCFIELDS before it.
You’ll need to make sure your sales line record has a type of Item.
Then retrieve that item from the database (GET).
Then do a CALCFIELDS on the Inventory field. As said in the reply above it is a flowfield. That means it is not a field stored in the database. It is calculated whenever it is needed. You have to tell the system to calculate it, thus the CALCFIELDS.
My problem is that i don’t know how to show in my report this flow field, but on Sales Line dataItem.
Look what I have Done:
On Sales Line - OnAfterGetRecord()
IF “Sales Line”.“No.” <> ‘’ THEN
IF RecItem.GET(“Sales Line”.“No.”) THEN;
You should make a new variable (InventoryVar), then put a textbox in your SalesLine body section and set the SourceExpr of the textbox to be your variable (InventoryVar). Then, in the Sales Line dataitem - OnAfterGetRecord, put the code:
IF (“Sales Line”.“Type.” = 2) AND (“Sales Line”.“No.” <> ‘’) THEN BEGIN
InventoryVar := ItemRec.Inventory;
As Matt said before, you should check that your sales line has the type = item (that’s what the first condition is doing, 2 = Item option).
Also, i would make that GET without an IF, since it seems ok to me to throw an error if somehow you have in a sales line an item that
not exists in Item table. If you don’t want to throw an error then you can use the IF and you will obtain a blank textbox if this situation arises.
Also, don’t forget to reinitialise your variable, since it is global.