how to print log info of querydef from linked table | Community
Skip to main content
Level 4
May 2, 2023
Question

how to print log info of querydef from linked table

  • May 2, 2023
  • 10 replies
  • 3190 views

Hi All,

 

Please add your suggestions here:

how to print log info of querydef from linked table:

============

logInfo("1st querydef " +CONSUMER.sConsumerLink.@SRCC_CON_ID);

==================================

my example:

<select>

<node expr="[sConsumerLink/@SRCC_CON_ID]" alias="@SRCC_CON_ID"/>

 

var ndQueryConsumer = queryBDerivedConsumer.ExecuteQuery();

 

if ( ndQueryConsumer.BDERIVEDCONSUMER.length() > 0 )

{

for each ( var CONSUMER in ndQueryConsumer.BDERIVEDCONSUMER ) {

logInfo("1st querydef " +CONSUMER.sConsumerLink.@SRCC_CON_ID);
==========

note : i tried this also but no luck:

 

logInfo("1st querydef " +CONSUMER.@SRCC_CON_ID);
==========

 

 

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

10 replies

david--garcia
Level 10
May 2, 2023

post the whole queryDef code.

ShrutiiAuthor
Level 4
May 2, 2023


var queryOptinBDerivedConsumer = xtk.queryDef.create(
1st querydef 

ShrutiiAuthor
Level 4
May 2, 2023

 

var queryOptinBDerivedConsumer = xtk.queryDef.create(
<queryDef distinct="true" schema="elc:BDERIVEDCONSUMER" operation="select">
<select>
<node expr="@DCNS_ID"/>

<node expr="[sConsumer/@SRCC_CON_ID]" alias="@SRCC_CON_ID"/>
//addin fields
<node expr="[BEMEDIA-DCNS_ID/@EMDA_ADDRESS]" alias="@EMDA_ADDRESS"/>

</select>
<where>
<condition boolOperator="AND" expr="@DCNS_BESTRECORD_TOCH_ID &lt;&gt; 0"/>

</where>
<orderBy>
<node expr="@DCNS_ID" sort="1"/>
</orderBy>
. </queryDef>
);

var ndQueryOptinBDerivedConsumer = queryOptinBDerivedConsumer.ExecuteQuery();

 

if ( ndQueryOptinBDerivedConsumer.BDERIVEDCONSUMER.length() > 0 )
{
for each ( var CONSUMER in ndQueryOptinBDerivedConsumer.BDERIVEDCONSUMER ) {
logInfo("1st querydef CONID " +CONSUMER.@SRCC_CON_ID);

 

 

gETTINg OUT PUT AS :

output:1st querydef CONID

 

 

BUT NEED VALUES FROM FIELDS

PLEASE HELP



 

 

 

david--garcia
Level 10
May 2, 2023

Post the whole code, look at the below links for reference.

var myXML = <queryDef schema="nms:recipient" operation="select"> <select> <node expr="@firstName"/> <node expr="@lastName"/> </select> </queryDef> var query = xtk.queryDef.create(myXML) var res = query.ExecuteQuery() for each (var rcp in res.recipient) logInfo(rcp.@firstName + " " + rcp.@lastName)

https://github.com/AdobeDocs/campaign-classic.en/blob/main/help/workflow/using/javascript-in-workflows.md

https://blog.floriancourgey.com/2018/08/use-querydef-the-database-toolkit-in-adobe-campaign

https://experienceleague.adobe.com/developer/campaign-api/api/sm-queryDef-ExecuteQuery.html

https://technowide.net/2017/05/19/iterating-custom-functions-record/

 

david--garcia
Level 10
May 2, 2023

Just do the following

 

 

 

var xml = <queryDef distinct="true" schema="elc:BDERIVEDCONSUMER" operation="select"> <select> <node expr="@DCNS_ID"/> <node expr="[sConsumer/@SRCC_CON_ID]" alias="@SRCC_CON_ID"/> <node expr="[BEMEDIA-DCNS_ID/@EMDA_ADDRESS]" alias="@EMDA_ADDRESS"/> </select> <where> <condition expr="@DCNS_BESTRECORD_TOCH_ID <> 0"/> </where> <orderBy> <node expr="@DCNS_ID" sort="1"/> </orderBy> </queryDef> var queryOBDC = xtk.queryDef.create(xml) var resOBDC = queryOBDC.ExecuteQuery() for each (var c in resOBDC) { logInfo(c.@DCNS_ID); logInfo(c.@SRCC_CON_ID); logInfo(c.@EMDA_ADDRESS): }

 

 

ShrutiiAuthor
Level 4
May 2, 2023

I WANT TO DO LOgINFO FOR both these columns ,,can u please help  

<node expr="[sConsumer/@SRCC_CON_ID]" alias="@SRCC_CON_ID"/>
					<node expr="[BEMEDIA-DCNS_ID/@EMDA_ADDRESS]" alias="@EMDA_ADDRESS"/>

 

ShrutiiAuthor
Level 4
May 2, 2023
<node expr="[sConsumer/@SRCC_CON_ID]" alias="@SRCC_CON_ID"/>
					<node expr="[BEMEDIA-DCNS_ID/@EMDA_ADDRESS]" alias="@EMDA_ADDRESS"/>

how to do loginfO for these 2columns that are linked to these tables

david--garcia
Level 10
May 2, 2023

Doesnt the following work?

 

                logInfo(c.@SRCC_CON_ID);
                logInfo(c.@EMDA_ADDRESS):
ShrutiiAuthor
Level 4
May 3, 2023

it didnt work

Manoj_Kumar
Community Advisor
Community Advisor
May 3, 2023

@shrutii try this

logInfo(""+c.@SRCC_CON_ID+""); logInfo(""+c.@EMDA_ADDRESS+""):
Manoj  | https://themartech.pro
ShrutiiAuthor
Level 4
May 3, 2023

tried this also

 

nothin eetin printed--I am reallys tuck in this part,,cn u please help

 

 

david--garcia
Level 10
May 4, 2023

Check the link between your schema and the other schema's, can you post an ERD diagram with cardinalities, also from the below; are you sure the link NAME is [sConsumer/.....], if you click on your schema -->configure list... are you able to see the fields from the other schema? post a screenshot

 

<node expr="[sConsumer/@SRCC_CON_ID]" alias="@SRCC_CON_ID"/> <node expr="[BEMEDIA-DCNS_ID/@EMDA_ADDRESS]" alias="@EMDA_ADDRESS"/>