Expand my Community achievements bar.

how to print log info of querydef from linked table

Avatar

Level 4

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);
==========

 

 

12 Replies

Avatar

Level 4


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

Avatar

Level 4

 

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



 

 

 

Avatar

Community Advisor

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-workflo...

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/

 

Avatar

Community Advisor

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):
	}

 

 

Avatar

Level 4

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"/>

 

Avatar

Level 4
<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

Avatar

Community Advisor

Doesnt the following work?

 

                logInfo(c.@SRCC_CON_ID);
                logInfo(c.@EMDA_ADDRESS):

Avatar

Community Advisor

@Shrutii try this

 logInfo(""+c.@SRCC_CON_ID+"");
                logInfo(""+c.@EMDA_ADDRESS+""):

     Manoj
     Find me on LinkedIn

Avatar

Level 4

tried this also

 

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

 

 

Avatar

Community Advisor

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"/>