This function works the same way as LookupOrCreate but allowing to filter by multiple parameters (not just one).
NAMESPACE
xmlns:AS="http://schema.advantages.cz/AsapFunctions"
SYNTAX
string LookupOrCreateEx(string lookupElementId, NodeSet parameters, NodeSet createParameters)
PARAMETERS
Name | Description |
---|---|
lookupId | Unique identifier (Guid) of lookup model element |
parameters | Key-value pairs of parameters for the lookup. |
createParameters | Key-value pairs providing data for a new record (in case it does not exist). |
REMARKS
See LookupOrCreate for a complete description.
EXAMPLE
Stylesheet
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:AS="http://schema.advantages.cz/AsapFunctions"
xmlns:date="http://exslt.org/dates-and-times" exclude-result-prefixes="AS date">
<xsl:template match="ROOT">
<!-- we are trying to get an airline id by its code -->
<xsl:variable name="code" select="'OA'"/>
<ROOT>
<!-- input filter parameters, can be multiple -->
<xsl:variable name="params">
<parameter key="Airline_parIataCode" value="{$code}"/>
</xsl:variable>
<!-- if not found we let it to be created -->
<xsl:variable name="valueParams">
<parameter key="Name" value="Origam Air"/>
<parameter key="IataCode" value="{$code}"/>
</xsl:variable>
<airlineId>
<!-- this single function will then always return a value -->
<xsl:value-of select="AS:LookupOrCreateEx('3abe98c3-e3b1-4960-b426-1f69532f8cd0', $params, $valueParams)"/>
</airlineId>
</ROOT>
</xsl:template>
</xsl:stylesheet>