0

I have this result mapping

<result element="lot" rowName="lotInfo">
        <element column="key_lot" name="lotId" exportType="SCALAR" xsdType="xs:long"/>
        <element column="lot_number" name="lotNumber" exportType="SCALAR" xsdType="xs:string"/>
        <call-query href="getTradeNameSQL">
            <with-param name="TN_CODE" query-param="trade_name"/>
        </call-query>
        <element column="expiry_date" name="expiryDate" exportType="SCALAR" xsdType="xs:date"/>
        <element column="Qte_administre" name="quantiteAdministre" exportType="SCALAR" xsdType="xs:float"/>
        <call-query href="getVocabulaireSQL">
            <with-param name="TYPE" query-param="unite_mesure_type"/>
            <with-param name="VOCABULARY_DOMAIN" query-param="unite_mesure_vocab_domain"/>
            <with-param name="CONCEPT_ID" query-param="unite_mesure"/>
        </call-query>
        <call-query href="getVocabulaireSQL">
            <with-param name="TYPE" query-param="ROUTE_ADMIN_type"/>
            <with-param name="VOCABULARY_DOMAIN" query-param="ROUTE_ADMIN_vocab_domain"/>
            <with-param name="CONCEPT_ID" query-param="ROUTE_ADMIN"/>
        </call-query>
        <element column="status_lot" name="status" exportType="SCALAR" xsdType="xs:string"/>
    </result>

and the result is

<lot xmlns="http://ws.wso2.org/dataservice">
<lotInfo>
    <lotId>616</lotId>
    <lotNumber>C4368AC</lotNumber>
    <tradeName>
        <tradeNameInfo>
            <code>ADACEL</code>
            <description>ADACEL</description>
            <agents>
                <agentInfos>
                    <id>1002805</id>
                    <code>SCT_AG0016</code>
                    <description>dcaT</description>
                </agentInfos>
            </agents>
        </tradeNameInfo>
    </tradeName>
    <expiryDate>2015-05-31T00:00:00.000-04:00</expiryDate>
    <quantiteAdministre>0.5</quantiteAdministre>
    <domains>
        <domainValue>
            <id>493416</id>
            <code>INV.UnitOfMeasure2</code>
            <description>ml (millilitre)</description>
            <type>DosageUnit</type>
        </domainValue>
    </domains>
    <domains>
        <domainValue>
            <id>433437</id>
            <code>IM</code>
            <description>Intramusculaire</description>
            <type>AdministrationRoute</type>
        </domainValue>
    </domains>
    <status>Expired</status>
</lotInfo>

That is correct.

My question is: As you can see there are two <domains> in the xml, because they came from the same query. But, Is there a way to give a different name to each one of them?

I'm using DSS 4.2.0

Thank you.

Luislode
  • 51
  • 1
  • 7

1 Answers1

0

I think the easiest way to resolve your problem is replacing each of your queries for a Complex Element and call inside it your Query. In this way you can define the Element Name for the subquery. The result maybe is not exactly what you expect but is very close. That's because adding the Complex Elements adds a new tag in your xml, something like:

<lot xmlns="http://ws.wso2.org/dataservice">
<lotInfo>
<lotId>616</lotId>
<lotNumber>C4368AC</lotNumber>
<tradeName>
    <tradeNameInfo>
        <code>ADACEL</code>
        <description>ADACEL</description>
        <agents>
            <agentInfos>
                <id>1002805</id>
                <code>SCT_AG0016</code>
                <description>dcaT</description>
            </agentInfos>
        </agents>
    </tradeNameInfo>
</tradeName>
<expiryDate>2015-05-31T00:00:00.000-04:00</expiryDate>
<quantiteAdministre>0.5</quantiteAdministre>
<unit>
  <domains>
    <domainValue>
        <id>493416</id>
        <code>INV.UnitOfMeasure2</code>
        <description>ml (millilitre)</description>
        <type>DosageUnit</type>
    </domainValue>
  </domains>
</unit>
<route>
  <domains>
    <domainValue>
        <id>433437</id>
        <code>IM</code>
        <description>Intramusculaire</description>
        <type>AdministrationRoute</type>
    </domainValue>
  </domains>
</route>
<status>Expired</status>

In the Data Service XML you just add an <element> tag to your queries:

<element name="unit" namespace="N/A">
    <call-query href="getVocabulaireSQL">
        <with-param name="TYPE" query-param="unite_mesure_type"/>
        <with-param name="VOCABULARY_DOMAIN" query-param="unite_mesure_vocab_domain"/>
        <with-param name="CONCEPT_ID" query-param="unite_mesure"/>
    </call-query>
</element>
<element name="route" namespace="N/A">
    <call-query href="getVocabulaireSQL">
        <with-param name="TYPE" query-param="ROUTE_ADMIN_type"/>
        <with-param name="VOCABULARY_DOMAIN" query-param="ROUTE_ADMIN_vocab_domain"/>
        <with-param name="CONCEPT_ID" query-param="ROUTE_ADMIN"/>
    </call-query>
</element>
Mr Lister
  • 45,515
  • 15
  • 108
  • 150
EnMalA
  • 11
  • 4