Personalization block How to query custom table from personalization block | Community
Skip to main content
Luca_Lattarini
Level 9
August 8, 2021
Solved

Personalization block How to query custom table from personalization block

  • August 8, 2021
  • 3 replies
  • 1227 views

Hello guys,

How can I query custom table from personalization block?

Thanks

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Manoj_Kumar

Hello @luca_lattarini 

 

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-oriented-apis.html?lang=en

 

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(); %>

 

3 replies

Manoj_Kumar
Community Advisor
Manoj_KumarCommunity AdvisorAccepted solution
Community Advisor
August 9, 2021

Hello @luca_lattarini 

 

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-oriented-apis.html?lang=en

 

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(); %>

 

Manoj  | https://themartech.pro
Marcel_Szimonisz
Community Advisor
Community Advisor
August 9, 2021

Hello @luca_lattarini ,

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=sqlselect

 

Marcel

 

Sukrity_Wadhwa
Community Manager
Community Manager
August 18, 2021

Hey @luca_lattarini,

 

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!

Sukrity Wadhwa