Avatar

Correct answer by
Employee Advisor

so I run the following query

 

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="@emailPreferredName"/>
                                            <node expr="@printPreferredName"/>                                            
                                            <node expr="@company"/>
                                            <node expr="@email"/>                                            
                                            <node expr="[location/@address1]" alias="@address1"/>
                                            <node expr="[location/@address2]" alias="@address2"/>
                                            <node expr="[location/@address3]" alias="@address3"/>
                                            <node expr="[location/@address4]" alias="@address4"/>                                            
                                            <node expr="[location/@city]" alias="@city"/>
                                            <node expr="[location/@zipCode]" alias="@zipCode"/>                                            
                                            <node expr="[lnkRelationshipManager/@firstName]+ ' ' + [lnkRelationshipManager/@lastName]" alias="@relationshipManager"/>
                                            <node expr="[eventRegistrations/@eventLabelName]" alias="@eventLabelName"/>
                                            <node expr="[lnkRelationshipManager/@schRelationshipManagerID]" alias="@rmid"/>
                                            <node expr="Iif([@clawfulBasis]=0,'Consent Removed',Iif([@clawfulBasis]=1,'None',Iif([@clawfulBasis]=2,'Legitimate Interest','Consent Given')))" alias="@lawfulBasis"/>
                                            <node expr="Iif(@blackList=1,'yes','no' )" alias="@blackList"/>
                                            <node expr="Iif(@eventOptinEmail=1,'yes','no' )" alias="@blackListEmail"/>
                                            <node expr="Iif(@eventOptinPost=1,'yes','no' )" alias="@blackListPostalMail"/>      
                                            <node expr="@jurisdiction"/>
                                            <orderBy>
                                               <node expr="@firstName"/>
                                             </orderBy>
                                        </select>
                                        <where>
                                          <condition expr="@id = 13244476" /> 
                                        </where>
                                       </queryDef> );

var res = query.ExecuteQuery();

on logging `logInfo(res)` the following I get.

 

 

<recipient-collection>
	<recipient address1="Adobe" address2="Old Street" address3="99" address4="Islington" blackList="no" blackListEmail="no" blackListPostalMail="no" city="London" cmOneID="-812156815" company="" email="davidxxx@xxx.com" emailPreferredName="David-Dgarcia" firstName="David-Testf" id="13244476" jurisdiction="SCPB - LON" lastName="Garcia-testl" lawfulBasis="None" printPreferredName="David G." relationshipManager="Adam Cavalier" rmid="2021" zipCode="SxxxST">
	<eventRegistrations eventLabelName="Event dummy test"/>
	</recipient>
</recipient-collection>

so is returning the eventLabelName and thought I could log it such as the following since I am using the alias, but didnt work.

 

for each (var r in res) {
logInfo(r.@eventLabelName)
}

so I end up using the following xpath and is working.

r.eventRegistrations.@eventLabelName

 

 

 

 

View solution in original post