get matched value(a)


This function is intended for the document types XML and EDIFACT.

It returns the value of the field's or node's match code that matched during the parsing of the input data. For the function to work, the following conditions must be met.


Description of Parameters


Parameter

Description

a

Node or field name. The parameter type must be Source field if the match code of a field is required. If you need the match code of a node, the type must be Value. Important note: If you are using document type EDIFACT, only nodes provide a meaningful result. In addition, the entire data line for which the match code matched is returned and not the match code itself, e.g. LIN+1++101556:SA

Example


Assume the following XML structure.


matchedvalue.xsd
 <?xml version="1.0" encoding="UTF-8"?>
<s:schema xmlns:s="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<s:element name="datalines" minOccurs="0" maxOccurs="unbounded">
<s:complexType>
<s:sequence>
<s:element name="data" minOccurs="0" maxOccurs="unbounded">
<s:complexType>
<s:simpleContent>
<s:extension base="s:string">
<s:attribute name="date" type="s:string"/>
<s:attribute name="time" type="s:string"/>
<s:attribute name="datetime" type="s:string"/>
</s:extension>
</s:simpleContent>
</s:complexType>
</s:element>
</s:sequence>
</s:complexType>
</s:element>
</s:schema>


An XML that conforms to this schema looks like this, for example.


matchedvalues.xml
 <datalines>
<data date="2011-12-23"/>
<data time="12:34:56"/>
<data datetime="2011-12-23 12:34:56"/>
</datalines>


This XML is to be converted into a simple CSV file of the following form.


Date:2011-12-23 00:00:00
Date:1970-01-01 12:34:56
Date:2011-12-23 12:34:56


Solving it the regular way, it would be necessary to create one field per attribute and find out the relevant one during the mapping. Using this function, all attribute values can be assigned to a single field.


images/download/attachments/62866961/get_matched_value_EN-version-1-modificationdate-1612425139481-api-v2.png


The match codes being used on source structure field date-2_attr are the following.


Condition

Value

Equals

date

Equals

time

Equals

datetime

The following functions are defined on destination structure field datefield.


1) get matched value(a)
a field: date-2_attr
 
2) replace value(a, list b, list c)
a result: 1
b constant: date,time,datetime
c constant: yyyy-MM-dd,HH:mm:ss,yyyy-MM-dd HH:mm:ss
 
3) create date strict(value a, adjustable template b, default c, [locale d])
a linked field:
b result: 2
c constant: error
d constant:
 
4) concat( a, b )
a constant: Date:
b result: 3

Example Profile


Download the profile used in this example here: Profile-get_matched_value_example.pak

Simply import the profile into your Lobster_data.

If you perform a mapping test, you will find the XML input file there.