Options

XMLport and large texts

Christian_WandborgChristian_Wandborg Member Posts: 23
edited 2011-06-30 in NAV Three Tier
Hi,

My XML-file contains an unspecified number of orders, and I’m using an XMLport to import orders from the file to my receiving table. Orders comes with an unspecified number of lines, and the lines include an element containing a product description. It’s likely that that the product descriptions contains large texts (e.g. 1000 - 4000 characters).

When the XMLport encounters product description element containing that many characters, it fails generating no error message.

Actually I don’t need the product description, and would rather skip this element, but I need suggestions on how to bypass it.

The following has been tried:

1. Element Properties:
Sourcetype = Text
TextType = Text
VariableName =Temp_Description

Code on the trigger: Product - Import::OnBeforeInsertRecord()
Temp_Description := ‘’;


2. Element Properties:
Sourcetype = Text
TextType = BigText


The above makes the port fail. That is, the XMLport import the orders until it encounter a product description containing a large number of characters.

Any suggestions please?
Regards
Christian

Answers

  • Options
    kinekine Member Posts: 12,562
    You have two possibilities:

    1) Import through XMLDOM instead XMLPort
    2) Use transformation to remove the elements before importing by xmlport. See examples how to remove namespaces, you can remove specific element in same way, just creating different transformation...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    Christian_WandborgChristian_Wandborg Member Posts: 23
    Hi,

    Actually, setting the element properties to

    SourceType = Text,
    TextType = BigText,
    VariableName = MyVariable

    makes the xmlport run through elements containing large texts. After all I need the contents (or part of) of the element, and was able to retrieve this by [RetLength] := BigText.GETSUBTEXT(Variable, Position [,Length]), found in help.

    Thanks for responding :)
    Regards
    Christian
Sign In or Register to comment.