2 (two) obstacles in importing xml file

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Jon, Steve, Ian, Dave

t4nu
Ebase User
Posts: 305
Joined: Thu Jul 02, 2015 8:32 am
Location: Indonesia

2 (two) obstacles in importing xml file

#1

Postby t4nu » Mon Sep 05, 2016 10:41 am

Hi,
I tried to import the xml file, but there are 2 (two) things bothered me.
1. Is it possible to set the directory and filename in the file adapter programmatically?

2. The xml was exported from excel file, the problem is the date field is
change to number in xml, how to make it back to date?

Thanks for the help.
0 x

Steve
Moderator
Moderator
Posts: 421
Joined: Fri Sep 07, 2007 3:44 pm
Location: Sandy, UK
Contact:

#2

Postby Steve » Mon Sep 05, 2016 2:16 pm

Hi,

You can use field substitution on the directory name and the filename e.g

e.g create an XML resource, create a file adapter and enter:

&&Dir into the directory field of the resource.
&&Filename into the filename field of the resource

Create fields in the resource:
Dir
Filename

Create your document structure and create the fields and tables for this also.

Create a form and add the resource, import the fields from the resource into the form:

In your script you can do something like this:

Code: Select all

fields.Dir.value = "c:/temp/";
fields.Filename.value = "test.xml";

resources.importXMLFile.read();
In reply to the dates:

My converted my Excel spreadsheet to xml and it created DateTime formatted objects:

Code: Select all

 <Date>2007-12-03T00&#58;00&#58;00.000</Date>
The date automatically mapped to an Ebase DateTime field without any conversion required.

I checked my spreadsheet and the column field data is set to DateTime.

Kind regards

Steve
0 x

t4nu
Ebase User
Posts: 305
Joined: Thu Jul 02, 2015 8:32 am
Location: Indonesia

#3

Postby t4nu » Tue Sep 06, 2016 9:31 am

Steve wrote:Hi,

You can use field substitution on the directory name and the filename e.g

e.g create an XML resource, create a file adapter and enter:

&&Dir into the directory field of the resource.
&&Filename into the filename field of the resource

Create fields in the resource:
Dir
Filename

Create your document structure and create the fields and tables for this also.

Create a form and add the resource, import the fields from the resource into the form:

In your script you can do something like this:

Code: Select all

fields.Dir.value = "c&#58;/temp/";
fields.Filename.value = "test.xml";

resources.importXMLFile.read&#40;&#41;;
Thank you very much for the help. Seems the field has many usage, not just for gather the user input.

In reply to the dates:

My converted my Excel spreadsheet to xml and it created DateTime formatted objects:

Code: Select all

 <Date>2007-12-03T00&#58;00&#58;00.000</Date>
The date automatically mapped to an Ebase DateTime field without any conversion required.

I checked my spreadsheet and the column field data is set to DateTime.
Do you mean to format the cell? I put =date(year, month, date) to those cells
0 x

Steve
Moderator
Moderator
Posts: 421
Joined: Fri Sep 07, 2007 3:44 pm
Location: Sandy, UK
Contact:

#4

Postby Steve » Tue Sep 06, 2016 9:48 am

I just looked at the Format Cell and the column is formatted as a Date DD-MM-YYYY... but I do not think the date format makes any difference.

How are you converting the Excel spreadsheet to XML? I can only convert my spreadsheet to XML Spreadsheet 2003 XML format.

Steve
0 x

t4nu
Ebase User
Posts: 305
Joined: Thu Jul 02, 2015 8:32 am
Location: Indonesia

#5

Postby t4nu » Tue Sep 06, 2016 10:31 am

I use xmltools, and if I remember correctly it's 2003 too.
Steve wrote:I just looked at the Format Cell and the column is formatted as a Date DD-MM-YYYY... but I do not think the date format makes any difference.

How are you converting the Excel spreadsheet to XML? I can only convert my spreadsheet to XML Spreadsheet 2003 XML format.

Steve
0 x

Steve
Moderator
Moderator
Posts: 421
Joined: Fri Sep 07, 2007 3:44 pm
Location: Sandy, UK
Contact:

#6

Postby Steve » Tue Sep 06, 2016 11:20 am

OK, send me your file to support@ebasetech.com and I will take a look.

Could you send me both the .xls and the .xml

Thanks

Steve
0 x


Who is online

Users browsing this forum: No registered users and 11 guests