How to deal with this XMLport error?
Aravindh_Navision
Member Posts: 258
Hi Friends,
I have an xml file as shown below.
How can I import this into the newly created table with the fields above in xml file using XMLport?
I have made one design using XML port as below.
Variables:
From On Push trigger of button in form, I wrote the below code.
While clicking the button, I am getting the following error?
"The Element <RESPONSE> can not be found from object description."
Can anyone tell me why this error is popping up and how to deal with it?
Thanks,
Aravindh.
I have an xml file as shown below.
- <RESPONSE>
<EXPR>USD</EXPR>
<EXCH>ARS</EXCH>
<AMOUNT>1</AMOUNT>
<NPRICES>1</NPRICES>
- <CONVERSION>
<DATE>Mon, 27 May 2013 19:00:00 GMT</DATE>
<ASK>0.1908</ASK>
<BID>0.1889</BID>
</CONVERSION>
</RESPONSE>
How can I import this into the newly created table with the fields above in xml file using XMLport?
I have made one design using XML port as below.
Node Name - Node Type - Source Type - Data Source (Indentation 0)ExchangeRate - Element - Table - <Currency Conversion - Table>(Currency Conversion - Table) (Indentation 1) RESPONSE - Element - Text - <RESPONSE> (Indentation 1) EXPR - Element - Field - Currency Conversion - Table::EXPR (Indentation 1) EXCH - Element - Field - Currency Conversion - Table::EXCH (Indentation 1) AMOUNT - Element - Field - Currency Conversion - Table::AMOUNT (Indentation 1) NPRICES - Element - Field - Currency Conversion - Table::NPRICES (Indentation 1) CONVERSION - Element - Text - CONVERSION (Indentation 1) DATE - Element - Field - Currency Conversion - Table::DATE1 (Indentation 1) ASK - Element - Field - Currency Conversion - Table::ASK (Indentation 1) BID - Element - Field - Currency Conversion - Table::BID
Variables:
Name DataType Subtype Length TestFile File InStreamObj InStream OutStramObj OutStream
From On Push trigger of button in form, I wrote the below code.
TestFile.OPEN('D:\MyFile.xml');
TestFile.CREATEINSTREAM(InStreamObj);
XMLPORT.IMPORT(50000,InStreamObj);
TestFile.CLOSE;
While clicking the button, I am getting the following error?
"The Element <RESPONSE> can not be found from object description."
Can anyone tell me why this error is popping up and how to deal with it?
Thanks,
Aravindh.
0
Comments
-
Remove (Delete) ExchangeRate line and make RESPONSE of source type table with Currency Conversion - Table0
-
Thanks ara3n.
After doing that, I'm getting error - "The element <CONVERSION> is unexpected."
What to do to overcome this error?0 -
Can you paste your xml file in here?0
-
-
In your xmlport Date, ASK and BID need to be intented to 2 instead of 1. But conversion is correct.
I'll try and see if I can replicate it.0 -
I just tried it with a text element and it works fine.
OBJECT XMLport 50010 Test xmlport { OBJECT-PROPERTIES { Date=05/29/13; Time=10:08:55 AM; Modified=Yes; Version List=; } PROPERTIES { } ELEMENTS { { [{8F14EBF6-D637-4128-957D-35DA9BD18FDE}]; ;RESPONSE ;Element ;Text } { [{A4F4D5BD-FEF4-41FF-B2BD-1E9EBC8F2B3F}];1 ;EXPR ;Element ;Text } { [{43EB9D27-0F55-40D2-900E-C0F390DA303E}];1 ;EXCH ;Element ;Text } { [{16662730-437F-4D42-8BF0-9EDDF06B1E3F}];1 ;AMOUNT ;Element ;Text } { [{C32D0F23-4572-485C-A0D8-1392A78C588C}];1 ;NPRICES ;Element ;Text } { [{00045B6C-F0E0-452F-885A-065EDB2023FE}];1 ;CONVERSION ;Element ;Text } { [{F087C801-C5B0-49F4-A754-2063F47105FA}];2 ;DATE ;Element ;Text } { [{C9E61516-37D5-4424-85BA-A55F6F8DE70C}];2 ;ASK ;Element ;Text } { [{4FFBEF5C-B7A4-43EC-A59E-1885A1A8D636}];2 ;BID ;Element ;Text } } EVENTS { } REQUESTPAGE { PROPERTIES { } CONTROLS { } } CODE { BEGIN END. } }
Does your xml file by any chance have multiple conversion elements?0 -
My hearty thanks to you ara3n. It is working now..!!
I have one more doubt. If you see the <DATE> node...<DATE>[b]Tue, 28 May 2013 19:00:00 GMT[/b]</DATE>
I need to convert this value to normal date format (05/28/2013) and send to the table. What to do for achieving this?
Variables:
strDay - strMonth - strYear are text variables.strDay := COPYSTR(DATE,6,2); strMonth := COPYSTR(DATE,9,3); strYear := COPYSTR(DATE,13,4); fnDate(); strStartingDate := strMonth + '/' + strDay + '/' + strYear;
I have done the above code. But I don't know how to proceed next?
Thanks,
Aravindh0 -
search for the function DMY2DATE. Convert your string parsed values to integers and build the date you need.kind of fell into this...0
-
Thanks jversusj.
Actually I need to send Tue, 28 May 2013 19:00:00 GMT as 05/28/2013 by converting it in XMLport itself and send to the table.
I don't find problem in converting, I got strucked on how to send from XML port in desired format to the table.
How to do this?0 -
Hi Guys,
I solved this issue. You guys just have a look.strDay := COPYSTR(DATE,6,2); strMonth := COPYSTR(DATE,9,3); strYear := COPYSTR(DATE,13,4); fnDate(); strStartingDate := strMonthNo + '/' + strDay + '/' + strYear; EVALUATE("<Currency Exchange Rate>"."Starting Date",strStartingDate);
Actually I need to update in Currency Exchange Rate."Starting Date" field.
Now I could able to insert it into the table field.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 324 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions

