# New Field in Report

I have a new field X : FlowField in Purchase Line. Sum Quantity in all purchase lines

I created a second field Z, to be calculated based on the first field value , how??

EX:

In purchase lines, in the end, the X field is completed with value 400

I want, for each line in purchase line, that Z = ((Quantity*100) / X)

How can I do it?

All my tests, in Purchase Line’s insert, the X value is 0, so I Got one error

Forget the folwfields and code just explain the business requirement. What are you trying to achieve.

hi …luana…

The flow field class only calculate the total line of the value…suppose u want each and every line calculation u must try sme coding level…once u try then let me know wat hpn…

Regards,

Packiya

packiyaraj@techconet.co.in

Hi Luna

Flow fields will be calculated at run time so uses calcfields(X)

Z:=(Qty*100)/(CALCIFIELDS(X))

Thanks

Jerome Marshal. J

I have 2 new fields, X and Y, in Purchase Lines.

Both are calculated after insert all purchase lines.

I must calculate TotalQuantityOrder = Sum(Quantity)

For each line:

X = Quantity * 100

Y= X / TotalQuantyinOrder

How can I implement this???

Are you using any function to calculate x and y or they have to claculate after inserting quantity?

They must be calculated after insert all lines in purchase line, because I need TotalQuantityOrder = sum(quantity) to be used in calculation of the other Y field.

X = Quantity * 100

Y= X / TotalQuantyinOrder

EX:

TotalQuantyinOrder = 60

Item 001 Quantity 20 X= 20 * 100 Y= 2000 / 60

Item 002 Quantity 30 X= 30 * 100 Y = 3000 / 60

Item 003 Quantity 10 X = 10* 100 Y = 1000 / 60

How implement this?

Then better to use a function to calculate it after inserting all lines…

and write the above formulaes in onpush trigger of the function…

This situation is on SubForm, and I need to print this information in report 405. Where Should I implement the function with these calculation?

Hi Luna

Are you inserting from external file ??

Thanks

Jerome Marshal. J

If these values are supposed to printed on a report (as the topic indicates) why don’t you just calculate the values there.

I personally wouldn’t add fields to the table for this.

BTW, shouldn’t you consider units of meassure in your calculations?

No, directly in purchase lines subform

then you can follow my suggestion…

Itried to put the calcs directly in report. But npo results.

In the report 405, what session will give the TotalQuanty in Order? I tried some and no one returns the sum of my field quantity

you said you need them in subform?

what code you have written?

Sorry

After insert all lines in subform Purchase Lines, i reaaly don’t need to see that fiels in my form. But I need to print them in my report 405.

So here what I have done:

RoundLoop - OnAfterGetRecord()

X := (“Purchase Line”.Quantity * 100);

Y := (X/TotalQuantity);

The TotalQuantity I can Get on RoudLoop OnAfterGetRecoird with this function:

TotalQuantity := “Purchase Line”.Quantity;

But Each Quantity to be printed on Va´riable Categ on each line of the report, I don’t Know where to put it

Categ := (“Purchase Line”.Quantity * 100);

I need this fiel to be printed in report 405.

RoundLoop - OnPreDataItem()

Categ:= (“Purchase Line”.Quantity * 100);

But on each line in the report, this value Categ is worong.Why??

Where can I pput this variable calculation to be right on each report 405 line