XMLport to import text file - error integer table readonly

hiddentexthiddentext Member Posts: 45
I am trying to build a xmlport that can import a text file to customer table using integer table. I based the development on an existing xmlport 5900 Imp. IRIS to Area/Symptom Code.

I am getting an error " The integer table is read-only".

OBJECT XMLport 50008 test2
{
  OBJECT-PROPERTIES
  {
    Date=05/24/09;
    Time=10:17:40 PM;
    Modified=Yes;
    Version List=NAVW16.00;
  }
  PROPERTIES
  {
    CaptionML=[ENU=Imp. IRIS to Area/Symptom Code;
               ESM=Imp. IRIS a µrea/C¢d. s¡ntoma;
               FRC=Imp. IRIS dans code zone/symp.;
               ENC=Imp. IRIS to Area/Symptom Code];
    Format=Variable Text;
  }
  ELEMENTS
  {
    { [{87B38AED-8742-4994-AD88-E9510356BA42}];  ;Root                ;Element ;Text     }

    { [{EFA3FFFA-3B05-44BC-AFD3-65A7DE7FF1A8}];1 ;Import              ;Element ;Table   ;
                                                  SourceTable=Table2000000026;
                                                  Import::OnBeforeInsertRecord=VAR
                                                                                 FaultArea@1000 : Record 5915;
                                                                                 SymptCode@1001 : Record 5916;
                                                                                 Item@1000000000 : Record 27;
                                                                               BEGIN
                                                                                 WITH Item DO BEGIN
                                                                                   INIT;
                                                                                   "No." := Text1;
                                                                                   Description := Text2;
                                                                                   "Search Description" := Text3;
                                                                                   MESSAGE('text3 %1', Text3);
                                                                                   IF NOT INSERT THEN
                                                                                     MODIFY;
                                                                                 END;
                                                                               END;
                                                                                }

    { [{39423B71-CCD9-44B2-AFA9-09DA62D16A35}];2 ;Text1               ;Element ;Text    ;
                                                  Import::OnAfterAssignVariable=VAR
                                                                                  Item@1000000000 : Record 27;
                                                                                BEGIN
                                                                                END;
                                                                                 }

    { [{B5A56E94-25BD-48B7-8C20-6B9422DFB368}];2 ;Text2               ;Element ;Text     }

    { [{C9D7C5C8-8FFE-46B3-87F9-FC88C7F19D29}];2 ;Text3               ;Element ;Text     }

  }
  EVENTS
  {
  }
  REQUESTPAGE
  {
    PROPERTIES
    {
    }
    CONTROLS
    {
    }
  }
  CODE
  {

    BEGIN
    END.
  }
}

Comments

  • ara3nara3n Member Posts: 9,256
    you can use the actual Item table. Set it to temporary. Make sure nothing is validated on the elements.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • hiddentexthiddentext Member Posts: 45
    Thanks ara3n.

    I tried using temporary table. I was able to insert to item table if there is only one row of record in the text file.
    If I tried to insert more than one row. I get the error message.

    Microsoft Dynamics NAV

    Item No. '' already exists.
    OK

    I can't debug on RTC. is very frustrating...
    OBJECT XMLport 50008 test2
    {
      OBJECT-PROPERTIES
      {
        Date=05/25/09;
        Time=[ 7:53:56 AM];
        Modified=Yes;
        Version List=NAVW16.00;
      }
      PROPERTIES
      {
        CaptionML=[ENU=Imp. IRIS to Area/Symptom Code;
                   ESM=Imp. IRIS a µrea/C¢d. s¡ntoma;
                   FRC=Imp. IRIS dans code zone/symp.;
                   ENC=Imp. IRIS to Area/Symptom Code];
        Format=Variable Text;
      }
      ELEMENTS
      {
        { [{87B38AED-8742-4994-AD88-E9510356BA42}];  ;Root                ;Element ;Text     }
    
        { [{EFA3FFFA-3B05-44BC-AFD3-65A7DE7FF1A8}];1 ;Import              ;Element ;Table   ;
                                                      SourceTable=Table27;
                                                      Temporary=Yes;
                                                      Import::OnBeforeInsertRecord=VAR
                                                                                     Item2@1000000000 : Record 27;
                                                                                   BEGIN
                                                                                     WITH Item2 DO BEGIN
                                                                                       INIT;
                                                                                       "No." := Text1;
                                                                                       Description := Text2;
                                                                                       "Search Description" := Text3;
                                                                                       MESSAGE('text1 %1', Text1);
                                                                                       Item2.INSERT;
                                                                                     END;
                                                                                   END;
    
                                                      Export::OnAfterGetRecord=VAR
                                                                                 item@1000000000 : Record 27;
                                                                               BEGIN
                                                                               END;
                                                                                }
    
        { [{39423B71-CCD9-44B2-AFA9-09DA62D16A35}];2 ;Text1               ;Element ;Text    ;
                                                      Import::OnAfterAssignVariable=VAR
                                                                                      Item@1000000000 : Record 27;
                                                                                    BEGIN
                                                                                    END;
                                                                                     }
    
        { [{B5A56E94-25BD-48B7-8C20-6B9422DFB368}];2 ;Text2               ;Element ;Text     }
    
        { [{C9D7C5C8-8FFE-46B3-87F9-FC88C7F19D29}];2 ;Text3               ;Element ;Text     }
    
      }
      EVENTS
      {
      }
      REQUESTPAGE
      {
        PROPERTIES
        {
        }
        CONTROLS
        {
        }
      }
      CODE
      {
    
        BEGIN
        END.
      }
    }
    
    
  • ara3nara3n Member Posts: 9,256
    After the following trigger
    Item - Import::OnBeforeInsertRecord()
    
    

    Add your code to delete all the record from Temporary Item Record.

    Item.deleteall;
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • hiddentexthiddentext Member Posts: 45
    it work perfectly. Thanks for you help
  • ara3nara3n Member Posts: 9,256
    you are welcome. :)
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Alex_ChowAlex_Chow Member Posts: 5,063
    ara3n wrote:
    After the following trigger
    Item - Import::OnBeforeInsertRecord()
    
    

    Add your code to delete all the record from Temporary Item Record.

    Item.deleteall;

    Genius!!
Sign In or Register to comment.