Avatar

Employee Advisor

Having issues with retrieving a field value from a linked schema [lnkEventRegistrations/@eventLabelName]

 

 

var query = xtk.queryDef.create(<queryDef schema="nms:recipient" operation="select"> 
                                        <select>
                                            <node expr="@id"/>
                                            <node expr="@cmOneID"/>
                                            <node expr="@firstName"/>
                                            <node expr="@lastName"/>
                                            <node expr="[lnkEventRegistrations/@eventLabelName]" analyze="false" alias="@eventLabelName" sort="true"/>
                                            <node expr="@emailPreferredName"/>
                                            <node expr="@printPreferredName"/>                                            
                                            <node expr="@company"/>
                                            <node expr="@email"/>                                                                                                                             
                                        </select>
                                        <where>
                                          <condition expr="@id = 13245436"/>
                                        </where>
                                       </queryDef> );


var res = query.ExecuteQuery();
logInfo(res)
for each (var r in res.recipient) {
  logInfo("r.@eventLabelName :"+r.@eventLabelName)
  logInfo("r.@firstName :"+r.@firstName)
}

 

 

 

04/09/2021 01:20:59 js r.@firstName :David-Event
04/09/2021 01:20:59 js r.@eventLabelName : <----------- empty

 

David__Garcia_0-1630717769423.png

David__Garcia_1-1630717877955.png

The link seems to be working from the recipient schema as it returns data from sch:eventRegistrations, however, on the querydef script the value is empty.

 

This is whats returned on the querydef execution, the @eventLabelName is not present.

 

04/09/2021 01:20:59 js <recipient-collection> <recipient cmOneID="-812156815" company="" email="xxx@xxx.com" emailPreferredName="Dave" firstName="David-Event" id="13245436" lastName="Garcia-Event" printPreferredName="David G."/> </recipient-collection>

 

Here is the link definition from recipient to event registration.

 

    <!-- Link to Relationship Manager Table -->
    <element integrity="define" label="event Registrations" name="lnkEventRegistrations"
             revLink="recipient" target="sch:eventRegistrations" type="link" unbound="true">
      <join xpath-dst="@recipient-id" xpath-src="@id"/>
    </element>
    <!-- End Link to Relationship Manager Table -->

 

There is also a link on the event registration schema to recipient.

 

 <element label="Recipients" name="recipient" target="nms:recipient" type="link"/>

@Florian_Courgey