Options

XMLPort for a txt file - RTC

poloniouspolonious Member Posts: 64
edited 2009-12-02 in NAV Three Tier
Hi fella's,

I'm trying to create an XMLPort that will run through the RTC to import a .txt file. I've created the XMLPort and added the neccesary code to an action on the relevant page to call it. However two things are happening:

1. The .txt file is being cleared straight away, it starts off as 260kb, and as soon as I run the XMLPort it becomes 0kb.
2. Because of the above (I think), I'm getting the following error message
"The Element <CustomerTbl> is expected by Min Occurs value: Once. Element received: <>."

Note it's not an xml file I'm trying to import, this shouldn't be a problem right?

Any help would be much appreciated.

Comments

  • Options
    fitolfitol Member Posts: 46
    Have you set the XMLport's Format property to something else than Xml?
  • Options
    poloniouspolonious Member Posts: 64
    Yeh, I have it set to "Variable Text".
  • Options
    ara3nara3n Member Posts: 9,255
    I guess you can change the min occurrence to zero and see if it works.
    Also I would test it in 2009 SP1. They have done a couple of changes for xmlport.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Options
    poloniouspolonious Member Posts: 64
    Hi ara3n,

    Yeh I tried setting that to zero alright, for some reason though the file is being completely deleted still!? Also, I'm now trying it on Nav2009 SP1.
  • Options
    kinekine Member Posts: 12,562
    It look like you run the XMLPort as Export instead Import... (thus overwriting the file)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    poloniouspolonious Member Posts: 64
    Hi Kine, wish it was that simple!! Afraid thats not it though, it's defined as an import and the code is calling it to import.
  • Options
    kinekine Member Posts: 12,562
    Ok, than try to use debugger and watch in which step the file is "truncated" to size 0.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    poloniouspolonious Member Posts: 64
    Wouldn't I have to debug in the RTC to do that? Not sure how that is achieved...
  • Options
    kinekine Member Posts: 12,562
    You need Visual Studio and running the NST on your PC. Than in NST config you need to enable debugging... more details are here: http://msdn.microsoft.com/en-us/library/dd301071.aspx
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    poloniouspolonious Member Posts: 64
    Cheers kine, I'll take a look now so.
  • Options
    RachelSoonRachelSoon Member Posts: 202
    Dear All,
    I am trying to import 2 lines of data with 2 column into Contact table. EG : No and Name.

    I have 2 line of records, but the XMLPort always import the 1st line of record. Any idea what i have missed out on the property setting?

    I have 4 line in the XMLPort desinger, as below :
    Root element Text <Root>
    Contact element Table <Contact> (Contact)
    No element Field Contact::No.
    Name element Field Contact::Name

    The XMLport porperty as default except :
    Direction : Import
    Format : Variable Text

    Regards,
    rachel
  • Options
    poloniouspolonious Member Posts: 64
    Are you getting an error Rachel?
  • Options
    RachelSoonRachelSoon Member Posts: 202
    hi,
    there is NO error.

    After run the XMLport from the RTC menu, i went back to classic, table contact to check the data.
    There is only 1 record get inserted into the table.

    Regards
    Rachel
Sign In or Register to comment.