如何在 navision 2009 中跳过功能

How to skip function in navsion 2009

我有一个可以添加文章的功能。 我有一个日期范围。但是如果它不在日期范围内,我想跳过这个函数(table 36):

FncCheckBOM(Description : Text[30])

LocRecSalesLine.SETRANGE("Document Type", Rec."Document Type");
LocRecSalesLine.SETRANGE("Document No.", Rec."No.");
LocRecSalesLine.SETRANGE(Type,LocRecSalesLine.Type::Item);
LocRecSalesLine.SETFILTER("BOM Item No.", '');
LocRecSalesLine.SETFILTER("Description 2", '*'+Description+'*');
LocRecSalesLine.SETFILTER("Purch. Order Line No.", '0');
LocRecSalesLine.SETFILTER("Job Contract Entry No.", '0');
IF LocRecSalesLine.FINDFIRST THEN
  REPEAT
  BEGIN
    FromBOMComp.SETRANGE("Parent Item No.",LocRecSalesLine."No.");
    NoOfBOMComp := FromBOMComp.COUNT;
    IF (NoOfBOMComp <> 0) AND (LocRecSalesLine."BOM Item No." = '') THEN
    BEGIN
      LocRecSalesLine.FncExplodeBOM;
    END;
  END
  UNTIL LocRecSalesLine.NEXT = 0;

LocRecSalesLine.RESET;
LocRecSalesLine.SETRANGE("Document Type", Rec."Document Type");
LocRecSalesLine.SETRANGE("Document No.", Rec."No.");
LocRecSalesLine.SETRANGE(Type,LocRecSalesLine.Type::" ");
LocRecSalesLine.SETFILTER("Description 2", '*'+Description+'*');
IF LocRecSalesLine.FINDFIRST THEN
  REPEAT
    LocRecSalesLine.DELETE;
  UNTIL LocRecSalesLine.NEXT = 0;

//AddItemDates.CheckDates(BeginDate, EndDate);

COMMIT;

我的方法是这样的(table 50012):

BetginDatumMessage := 'begindatum is yessss:';
 Rec.SETRANGE("Parent Item No.","Parent Item No.");
 IF Rec.FIND() THEN;
  //Rec.SETRANGE("Parent Item No.","Parent Item No.");
  //Rec.SETRANGE("Item No.","Item No.");
  MESSAGE('Date is ok');
  //BeginDate := TODAY + 1 ;
  //EndDate := TODAY + 2;
   MESSAGE(BetginDatumMessage + '' + FORMAT(Rec.BeginDate));
   MESSAGE(FORMAT(TODAY));
   IF (TODAY >= Rec.BeginDate) AND (TODAY <= Rec.EndDate) THEN BEGIN
   MESSAGE('Dat is fine');
    RecSalesHeaderQuote.FncCheckBOM(SalesLines.Description);
    MESSAGE(FORMAT(BeginDate));
    MESSAGE(SalesLines.Description);
  END
  ELSE BEGIN
  MESSAGE('other');

  END;

因为现在总是触发函数:FncCheckBOM(Description : Text[30])

不必是什么。

谢谢

BetginDatumMessage := 'begindatum is yessss:';
 Rec.SETRANGE("Parent Item No.","Parent Item No.");
 IF Rec.FIND() THEN;
  MESSAGE('Date is ok');
   IF (TODAY >= Rec.BeginDate) AND (TODAY <= Rec.EndDate) THEN BEGIN
   MESSAGE('Dat is fine');
    RecSalesHeaderQuote.FncCheckBOM(SalesLines.Description);
    MESSAGE(FORMAT(BeginDate));
    //MESSAGE(SalesLines.Description);
  END
  ELSE BEGIN
  EXIT;
  MESSAGE('other');
  END;
   IF (Rec.BeginDate = 0D) AND (Rec.EndDate = 0D ) THEN BEGIN
    MESSAGE('Empty');
  END;

跳过你的函数在你想要的代码部分放句子:

EXIT;

此语句将使您的方法结束并退出函数。