Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Personalization block How to query custom table from personalization block

1982luca
Level 8
Level 8

Hello guys,

How can I query custom table from personalization block?

Thanks

1 Accepted Solution
Manoj_Kumar_
Correct answer by
Community Advisor
Community Advisor

Hello @1982luca 

 

use can query the data from customer table via the adobe campaign data api.

 

Reference link: https://experienceleague.adobe.com/docs/campaign-classic/using/configuring-campaign-classic/api/data...

 

Sample Code:

<%

var query=xtk.queryDef.create(<queryDef schema="nms:recipient" operation="select">
  <select>
    <node expr="@email"/>
    <!-- builds a string with the concatenation of the last name and first name separated by a dash -->      
    <node expr="@lastName+'-'+@firstName"/>
    <!-- get year of birth date -->
    <node expr="Year(@birthDate)"/>
  </select> 

  <where>  
     <condition expr="[@folder-id] = 1234 and @domain like 'Adobe%'"/>
  </where>

  <!-- order by birth date -->
  <orderBy>
    <node expr="@birthDate" sortDesc="true"/> <!-- by default sortDesc="false" -->
  </orderBy>
</queryDef>);

var records = query.ExecuteQuery();

%>

 

View solution in original post

3 Replies
Manoj_Kumar_
Correct answer by
Community Advisor
Community Advisor

Hello @1982luca 

 

use can query the data from customer table via the adobe campaign data api.

 

Reference link: https://experienceleague.adobe.com/docs/campaign-classic/using/configuring-campaign-classic/api/data...

 

Sample Code:

<%

var query=xtk.queryDef.create(<queryDef schema="nms:recipient" operation="select">
  <select>
    <node expr="@email"/>
    <!-- builds a string with the concatenation of the last name and first name separated by a dash -->      
    <node expr="@lastName+'-'+@firstName"/>
    <!-- get year of birth date -->
    <node expr="Year(@birthDate)"/>
  </select> 

  <where>  
     <condition expr="[@folder-id] = 1234 and @domain like 'Adobe%'"/>
  </where>

  <!-- order by birth date -->
  <orderBy>
    <node expr="@birthDate" sortDesc="true"/> <!-- by default sortDesc="false" -->
  </orderBy>
</queryDef>);

var records = query.ExecuteQuery();

%>

 

View solution in original post

Marcel_Szimonisz
Community Advisor
Community Advisor

Hello @1982luca ,

apart from the @Manoj_Kumar_  asnswer -querydef- you you can also use:

 

 

 

sqlSelect from jsapi:

var res = sqlSelect("publicUrl,@sstringValue:string",
        "select sstringValue from XtkOption where sname='XtkFileRes_PublicUrl'")
logInfo(res.publicUrl.@sstringValue.toString(

 

 

 

 

https://docs.adobe.com/content/help/en/campaign-classic/technicalresources/api/f-sqlSelect.html?hl=s...

 

Marcel

 

Sukrity_Wadhwa
Employee
Employee

Hey @1982luca,

 

Were you able to resolve this query with the help of the given solutions or do you still need more help here? Do let us know.


Thanks!