ue_file2datastore

Read and Convert a xml file

 

object=ue_file2datastore=command

 

You can use this object with datastorevalues.importfromxml

 

load=<file>

load xml file

setarea=<area>

 

example

<area1><area2><value>test</value></area2><area>

 

lfile=load=<xmlfile>

lfile=setarea=area2

 

Result:

<value>test</value>

filetype

 

xml = XML Type

xls = Excel

odbc = ODBC

 

all other CSV and Text file

 

with checkfiletype you can analyse the source file (not excel)

 

Example see convert

checkfiletype

 

works for XML and CSV/TXT  File formats (not excel)

check if this is a xml file
if not, check the delimiter, quotation marks and so on

 

lfile=load=<file>

lfile=checkfiletype

messagebox=type <lfile.filetype>, delimiter <lfile.delimiter> <lfile.quotationmarks>

convert

 

Example: import xml or csv file

lfile=checkfiletype

lfile=load=<filename>

lfile=convert

 

Example: import excel file

lfile=filetype=xls

lfile=load=<xmlfile>

lfile=convert

 

Example: generaly (without excel)

 

Result: ids_value with all values

readcolumns

 

lfile=load=<xmlfile>

lfile=readcolumns

 

in ids_header you have all columns and columns length

readvalues

 

lfile=load=<xmlfile>

lfile=readcolumns

lfile=readvalues

 

in ids_values you have all values

createdatastore

 

lfile=load=<xmlfile>

lfile=readcolumns

lfile=createdatastore

 

ids_values is created, but without values

saveaspsr=<filename>

save imported file to a psr file

 

 

Properties

headerline

is_headerline=1

in which line is the header in csv file

delimiter

is_delimiter=<tab>

line feed in csv file

quotationmarks

is_quotationmark=<empty>

quotationmark in csv file, example "

linefeed

is_linefeed=<cr_lf>

line feed sign

filetype

is_filetype

type of import file

xml, xls or empty for all other

dsn

is_dsn

set DSN for type ODBC

 

XML Attributes

hmtoggle_plus1Define meaning of tag attributes in XML Files

 

Example: <attrib colname="ItemCode" description="Bill of Material Itemcode">

Means: Tag name = "ItemCode" and not "attrib"
For Import programm the Description of this Column is "Bill of Material"

 

Example for allowed XML Files

<item value="1001">

<bom>

  <pos>10</pos>

 <attribute itemcode="A002" quantity="10">

</bom>

<bom>

  <pos>20</pos>

 <attribute itemcode="A003" quantity="2">

</bom>

</item>

 

Not allowed is a mix of substructures and values outside the tag definition

Example:

<bom>10<itemcode>a001</itemcode></bom>

In this example beas ignore the value "10"

 

Property

instance variable

Description

XMLAttribColName

is_XMLAttribColName

Define the name of Tag Field

Example:

lfile.XMLAttribColName=colname

XML-File

<attrib colname="ItemCode">

the program replace the tagname "attrib" with "ItemCode"

 

Default: COL_NO

XMLAttribDescription

is_XMLAttribDescription

Define the description of this tag in the import program

Example:

lfile.XMLAttribDescription=ItemCode

XML-File

<x884544xx description=ItemCode>

The Tag Name is x884544

In Import you see in Preview "ItemCode" as fieldname

 

Default: FIELDNAME

XMLAttribLength

is_XMLAttribLength

Define the max. length of this field

 

Default: LEN

XMLAttribType

is_XMLAttribType

Define the type of the field (current without function)

 

Default: TYPE

XMLAttribValue

is_XMLAttribValue

Define, in which attribute you can define the value

Example:

lfile.XMLAttribValue=VALUE

XML-File

<itemcode value="A001" />

is the same as

<itemcode>A001</itemcode>

in this way you can define sub structure in shorter way

<itemcode value="A001">

< ... substru ..>

</itemcode>

 

Default: TYPE

XMLAttribColDescription

is_XMLAttribColDescription

Define a translation for a tag

Example

lfile.XMLAttribColName=COL_ID

lfile.XMLAttribColDescription=NAME

XML-File

<attrib col_name="x1" name="ItemCode"/>

...

<attrib col_name="x1">A001</attrib>

In this case the tag name "x1" will be replaced with "ItemCode"

 

if beas find the AttributName - in this case "NAME", then beas ignore all values and other attributes for this tag.

 

Default: not defined

XMLAttribExpand

il_XMLAttribExpand

If activ, the program define a separat column for each attribut

Example:

<item drawing="a1000" ref="5" version="20" value=A001">

<bom itemcode="material1"/>

<bom itemcode="material2"/>

</item>

create follow columns

item, drawing, ref, version, itemcode

 

Default: 0 (disable)

 

 

Place Holder

filetype

Return current file type (xml/xls or empty for all other)

source

Return loaded Source code

errormessage

Return last errormessage

filename

Name of current file

column2string

 

lfile=load=<xmlfile>

lfile=readcolumns

messagebox=<lfile.column2string>

 

 

Instance:

is_source = Source Code

is_start = start Element in the source

ids_header = All Elements inside the source

ids_values = all Values and column "area" with current area

is_errortext

 

ids_header: columnname,length