calcsums in sql 2005

117320117320 Member Posts: 33
Hi, all

Can someone help me,i am using sql 2005 and nav 4.0 sp3,my coding like this :

lvAccountHeader.reset;
IF lvAccountHeader.FINDSET THEN BEGIN
lvAccountHeader.CALCSUMS("Total Paid");
lvTotalPaid := lvAccountHeader."Total Paid";
END;

lvTotalPaid return 0

when i see to the table Total Paid got value.in the key i already put Total paid as sumindexfield in the primary key.

why is this happen?is there any setup that i must do first?

Comments

  • DenSterDenSter Member Posts: 8,304
    That field is probably a flowfield, not a sumindexfield. Try CALCFIELDS("Total Paid") instead. Remove that field as a sumindexfield.

    By the way, you don't need to do IF FINDSET when you do a CALCSUM, that is not necessary.
  • 117320117320 Member Posts: 33
    Total Paid field is a normal field,is not a flowfield. total paid is declare as a sumindexfield for primary key.
  • ara3nara3n Member Posts: 9,256
    remove findset as Daniel mentioned. Also make sure you have actual any record in the table and that you are referencing the correct table.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • DenSterDenSter Member Posts: 8,304
    Maybe they all add up to 0, or else you're not sharing other filters that you've set. If you truly defined the field as a sumindexfield, and you are doing a CALCSUM, and there are values in that field, it should add up properly.
  • 117320117320 Member Posts: 33
    Thanks All,i can use calcsums,i remove findset then the result come up.
Sign In or Register to comment.