Field Exist

supp85supp85 Member Posts: 76
Hello,

When the Document No. is inserted in the Payment Journals i need it to error if the Document No. already exists in any of the other batch within the Payment Journals, i'm not entirely sure but could I use the FIELDEXIST function here?

Comments

  • einsTeIn.NETeinsTeIn.NET Member Posts: 1,050
    Do you mean RecordRef.FIELDEXIST? No, that's to check if a field with a certain number exists in a table.

    You need a second record variable of the payment journal and filter it for Journal Template Name and Document No.
    YourGenJnlLine.SETRANGE("Journal Template Name","Journal Template Name");
    YourGenJnlLine.SETRANGE("Document No.","Document No.");
    IF NOT YourGenJnlLine.ISEMPTY THEN
      ERROR('%1 is already in use',"Document No.");
    
    What about posted payment journals?
    "Money is likewise the greatest chance and the greatest scourge of mankind."
  • supp85supp85 Member Posts: 76
    Thank you for your reply, yes i did mean RecordRef.FIELDEXIST, i hadn't used it before and thought it could be used here.

    For posted Journals could i not check against the Last No. Used?
Sign In or Register to comment.