How to use CALCFIELDS

James111James111 Member Posts: 63
Hi,

I have problem, because i would like get FlowField(Cost Amount (Expected)) from table : Item Ledger Entry to my report.

My code:
Variables: Cost - decimal.

CALCFIELDS(Cost Amount (Expected));
Cost:=Cost Amount (Expected);

But it doesn't work,

Plese give me answer.

Thanks,
James

Comments

  • SavatageSavatage Member Posts: 7,142
    is item ledger entry the dataitem of your report?
    http://msdn.microsoft.com/en-us/library/dd338975.aspx
    ex/
    [Ok :=] Record.CALCFIELDS(Field1, [Field2],...)

    ILE.CALCFIELDS("Adjusted Cost (Expected)");

    Are you just getting a zero or are you getting an error?
    make sure you test it on a entry that actually has a value.
  • James111James111 Member Posts: 63
    DataItem is "Item Ledger Entry" and Value is 0,00.

    I don't know where is the problem.

    James
  • jspoppjspopp Member Posts: 54
    Hi, put a breakpoint there and run it through the debugger. I bet you'll find your solution pretty quickly. BTW, I am assuming you are using Classic. Good luck!
  • SavatageSavatage Member Posts: 7,142
    Are you putting your code OnAfterGetRecord trigger of the ILE dataitem?

    Can we assume this "cost" variable is the Sourcexp of a textbox that exists in the body of the report?

    Are you testing the report with a ILE that actually has a value. Note that field doesn't always contain a value.

    Perhaps you'r looking to do more of a.....
    ILE.Calcfields("Adjusted Cost", "Adjusted Cost (Expected)");
    If ILE."Adjusted Cost" = 0 then
    cost := ILE."Adjusted Cost (Expected)" else
    cost := ILE."Adjusted Cost";
    

    Unless you're just trying to find the ILE that are not zero.
  • James111James111 Member Posts: 63
    edited 2012-10-04
    Yes, I putted trigger OnAfterGetRecord,

    I used variable: Cost in a report.


    I will try..
    Thanks
  • SavatageSavatage Member Posts: 7,142
    did you try the above code? or is this report specifically looking the "expected" field?
  • James111James111 Member Posts: 63
    No, i didn't try yours code, mayby it work.

    James
  • SavatageSavatage Member Posts: 7,142
    are you also filtering on Item No.?

    Find an item that you are sure has a value in that field and test it.
  • James111James111 Member Posts: 63
    It's working, Cost Amount (Expected) it's realy 0,00:) - this is wrong field.

    Correct field is ;Cost Amount (Actual)


    Thanks for your helps.

    James:)
  • SavatageSavatage Member Posts: 7,142
    Sometimes it's the little things. 8)

    ILE can grow really large I like to throw a SETCURRENTKEY line in to help speed it up.

    ex/
    SETCURRENTKEY("Item No.","Variant Code","Drop Shipment","Location Code","Bin Code","Posting Date");
Sign In or Register to comment.