Sum Routing Line table field

Hello.
I need to sum a field real time, where center no is M-150.
I need to do it without flowfield.

I make this, but gives me only 0 as result.

Routing Line table -> new field -> Sum M-150 as decimal field
Routing Line table -> new funcition -> SumTotal150
Variables for this funcion -> RoutLine, datatype is record, subtype is Routing Line

Code:

RoutLine.RESET;
RoutLine.SETCURRENTKEY("Routing No.", "Work Center No.");
RoutLine.SETRANGE("Routing No.","Routing No.");
RoutLine.SETRANGE("Work Center No.", 'M-100');
RoutLine.CALCSUMS("Real Time");


Save this result.

I go to my new field Sum M-150 on validate() and place there name of the function like this -> SumTotal150;

Result is everything 0

Where do I make a mistake?

Best Answer

Answers

  • TallyHoTallyHo Member Posts: 417
    Add a return variable to funtion SumTotal150.

    add
    exit(RoutLine."Real Time");
    as last line of the function.

    Put the function SumTotal150 in your page, where you now put the field "Sum M-150".
    Set the page field to editable FALSE.
  • Some code snipet pls
  • VeselinVeselin Member Posts: 19
    Some code snipet pls

    mqx6sy1icidc.png
    new field Sum M-150


    xzi8y9pcguys.png
    onvalidate field Sum M-150


    55y75mrwn5gj.png
    function



  • VeselinVeselin Member Posts: 19
    TallyHo wrote: »
    Add a return variable to funtion SumTotal150.

    add
    exit(RoutLine."Real Time");
    as last line of the function.

    Put the function SumTotal150 in your page, where you now put the field "Sum M-150".
    Set the page field to editable FALSE.



    Nothing changed.
    12zvu4miwvfa.png
    j0o8usqesmhw.png
  • TallyHoTallyHo Member Posts: 417
    Do not put the function in onvalidate of the field.
    Add the function to the form or page, just like you added the field like this:

    6bb5ud89q0nf.png
Sign In or Register to comment.