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.
2 (two) obstacles in importing xml file
Moderators: Jon, Steve, Ian, Dave
-
- Ebase User
- Posts: 305
- Joined: Thu Jul 02, 2015 8:32 am
- Location: Indonesia
-
- Moderator
- Posts: 421
- Joined: Fri Sep 07, 2007 3:44 pm
- Location: Sandy, UK
- Contact:
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:
In reply to the dates:
My converted my Excel spreadsheet to xml and it created DateTime formatted objects:
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
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();
My converted my Excel spreadsheet to xml and it created DateTime formatted objects:
Code: Select all
<Date>2007-12-03T00:00:00.000</Date>
I checked my spreadsheet and the column field data is set to DateTime.
Kind regards
Steve
0 x
-
- Ebase User
- Posts: 305
- Joined: Thu Jul 02, 2015 8:32 am
- Location: Indonesia
Thank you very much for the help. Seems the field has many usage, not just for gather the user input.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:/temp/"; fields.Filename.value = "test.xml"; resources.importXMLFile.read();
Do you mean to format the cell? I put =date(year, month, date) to those cellsIn reply to the dates:
My converted my Excel spreadsheet to xml and it created DateTime formatted objects:
The date automatically mapped to an Ebase DateTime field without any conversion required.Code: Select all
<Date>2007-12-03T00:00:00.000</Date>
I checked my spreadsheet and the column field data is set to DateTime.
0 x
-
- Moderator
- Posts: 421
- Joined: Fri Sep 07, 2007 3:44 pm
- Location: Sandy, UK
- Contact:
-
- Ebase User
- Posts: 305
- Joined: Thu Jul 02, 2015 8:32 am
- Location: Indonesia
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
-
- Moderator
- Posts: 421
- Joined: Fri Sep 07, 2007 3:44 pm
- Location: Sandy, UK
- Contact:
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
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 19 guests