Total Line in List Form

ZuxelZuxel Member Posts: 6
edited 2009-07-16 in NAV Tips & Tricks
Hi all

Sometimes clients ask me to add a "total" line on the list form without adding a record to the source table.
Maybe this code will helps someone...

n - Integer
Text001 - Text Constant
Rec.Code - source record key field
Form - OnFindRecord(Which : Text[1024]) : Boolean
IF (Which = '+') OR ((Code = Text001) AND (Which = '=><')) THEN BEGIN
  INIT;
  Code := Text001;
  // Counting sums
  EXIT(TRUE);
END;
EXIT(FIND(Which));

Form - OnNextRecord(Steps : Integer) : Integer
IF Steps > 0 THEN BEGIN
  IF Code = Text001 THEN
    EXIT(0);
  n := NEXT(Steps);
  IF (n = 0) AND (Code <> Text001) THEN BEGIN
    INIT;
    Code := Text001;
    // Counting sums
    EXIT(1);
  END ELSE
    EXIT(n);
END ELSE BEGIN
  IF Code = Text001 THEN BEGIN
    IF Steps = 0 THEN
      EXIT(0);
    FINDLAST;
    EXIT(NEXT(Steps + 1) - 1);
  END;
  EXIT(NEXT(Steps));
END;

Comments

  • David_SingletonDavid_Singleton Member Posts: 5,479
    Zuxel wrote:
    Hi all

    Sometimes clients ask me to add a "total" line on the list form without adding a record to the source table.
    Maybe this code will helps someone...

    My self I just convince the Client to add the new record, the advantage being that then you just use standard flow fields and it's then all standard Navision and no code on forms.

    But...

    This is quite a neat trick.
    David Singleton
Sign In or Register to comment.