Skip header record on CSV when using XMLport

ricky76ricky76 Member Posts: 204
edited 2014-07-29 in NAV Three Tier
Does anyone know if this can be achieved?

Comments

  • Wisa123Wisa123 Member Posts: 308
    Just create a Bool - Variable

    Firstline - Boolean

    -OnPreXMLPort-
    firstline := true;

    -OnBeforeInsertRecord- (or wherever you start processing)
    IF firstline then begin
    firstline := false;
    currxmlport.skip;
    end;
    Austrian NAV/BC Dev
  • ricky76ricky76 Member Posts: 204
    I don't believe this type of approach works on xmlports does it? I have tried this just to verify and it doesn't.
  • Wisa123Wisa123 Member Posts: 308
    I've spent the last 2 Months nearly eclusively designing XMLPorts and i approached that problem a LOT.

    Its quite simple: Find out if you are in the first line. In this case just currxmlport.skip.

    If you dont like my solution maybe this can help you out: http://mibuso.com/forum/viewtopic.php?t=54346
    Austrian NAV/BC Dev
  • yukonyukon Member Posts: 361
    Hi ricky76,
    Wisa123 wrote:
    Just create a Bool - Variable

    Firstline - Boolean

    -OnPreXMLPort-
    firstline := true;

    -OnBeforeInsertRecord- (or wherever you start processing)
    IF firstline then begin
    firstline := false;
    currxmlport.skip;
    end;

    I agree with Wisa123. That's correct solution. But we can't see your xml port design.




    Best Regards,
    Yukon
    1.GIF 11.5K
    2.GIF 14.5K
    Make Simple & Easy
  • ricky76ricky76 Member Posts: 204
    If a have a decimal field in the csv file though and that column has a header of 'Amount' then i don't get the chance to access any triggers on the XMLPort except the onPreXMLPort before it throws an error at me.
  • yukonyukon Member Posts: 361
    Hi ricky76,

    That's is different error. If you don't mind, could you show your xml port at here. I hope someone also can help to you.

    Regards,
    Yukon
    Make Simple & Easy
  • bob_upbob_up Member Posts: 155
    edited 2014-07-29
    Just wondering if anyone knows the solution to the difficulty that Ricky mentioned in his most recent post?
  • bob_upbob_up Member Posts: 155
    I cant use the method recommended in this thread because it only works if all the elements are of the "Source Type" text. I was using this method but discovered that I couldnt perform the necessary field validation/assignment in code because of a problem with Xrec. I have to use the inbuilt validation of the XMLPort. To do that I need to import straight into the record variables, some of which are decimal.
Sign In or Register to comment.