Problem with XML port on import transactions

T222T222 Member Posts: 63
Hi, I have a problem during import a file with an XML Port.
I'm trying to import a text file where if the account number starts from B the Account Type should be bank.
On my xml -on Gen. Journal Line - Import::OnBeforeInsertRecord() i have the following line but the system prompts me an error when it reads the specific line because its searching the number from GL and not Banks.

IF COPYSTR("Gen. Journal Line"."Account No.",1,1) ='B' THEN BEGIN
AccountType := 3;

Can you please help me?

Best Answer

  • KishormKishorm Member Posts: 921
    Answer ✓
    Try the following in the OnAfterAssignField trigger of the "Account No." field instead...
    IF COPYSTR("Gen. Journal Line"."Account No.",1,1) ='B' THEN BEGIN
      "Gen. Journal Line"."Account No." := COPYSTR("Gen. Journal Line"."Account No.",2);
      "Gen. Journal Line"."Account Type" := "Gen. Journal Line"."Account Type"::Bank;
    END;
    

Answers

  • KishormKishorm Member Posts: 921
    Answer ✓
    Try the following in the OnAfterAssignField trigger of the "Account No." field instead...
    IF COPYSTR("Gen. Journal Line"."Account No.",1,1) ='B' THEN BEGIN
      "Gen. Journal Line"."Account No." := COPYSTR("Gen. Journal Line"."Account No.",2);
      "Gen. Journal Line"."Account Type" := "Gen. Journal Line"."Account Type"::Bank;
    END;
    
  • T222T222 Member Posts: 63
    Thanks!!!!!!!!!!!!!!!!!!!!!!
Sign In or Register to comment.