Expand my Community achievements bar.

SOLVED

Trying to select the next row of a list as a variable.

Avatar

Level 2

Hi there,

I have uploaded a list in a workflow and I am trying to query the value of the 1st for the 1st row as well as the value of the 1st column for the 2nd row, the whole thing to be used in dynamic content.

Is there any way to do it in Adobe Campaign?

For example:

In the table below, I would like to use the <%= targetdata.Value1 %> which correspond to 12 as well as the second row. The challenge we have is that each value corresponds to the primary key queried, therefore we would need to add a selection of the next row.

Is there any way to do it?

Value 1Value 2Value 3Value 4
121781111234
131791121432
1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi Kenji,

I have used a simple example to illustrate your case and it is working.

Step 1: use String when assigning xml value to a variable.

1538733_pastedImage_1.png

Step 2: use new XML to cast back a string to xml and use string to print the value of a variable.

1538732_pastedImage_0.png

if this doesn't work there will be something wrong with target mapping for your alert, try sending a static alert to debug that.

Regards,

Amit

View solution in original post

5 Replies

Avatar

Community Advisor

Hello,

you can follow the documentation Data oriented APIs

You can do the following:

Good to know - in order to have in the pipeline the variable  vars.targetSchema you need to use any of the query activities or enrichment which will store the value.

var query = xtk.queryDef.create(

<queryDef schema={vars.targetSchema} operation="select">

<select>

    <node expr="value1">

    <node expr="value2">

    ...  </select>

//order your target data

  <orderBy>

    <node expr="value1" /*sortDesc="true"*/>

  </orderBy>

</select>

</ueryDef>

);

var res = query.executeQuery();

for each (var row in res)

     logInfo(row.value1);

Marcel

Avatar

Level 2

Hi Marcel,

Thanks a lot for your reply and sorry for not giving any feedback earlier.

Your comment was very helpful and I found another discussion on the forum related to what I am trying to achieve: Re: Use of variable in continuous delivery, how to do ?

To give some context, I am trying to send in an alert all the last deliveries with their metrics. To do so I 1)run a query 2)use some JavaScript code to store the data in an instance 3)Run the loop in the alert.

The setup looks like this:

Capture.PNG

The JavaScript is the following:

Capture.PNG

The alert code is the following:

Capture.PNG

I have not added all the Node expressions in the output as I just want to run a test at the moment. However, I get this error message:

XSV-350122 An error occurred and the process has been stopped.

SOP-330011 Error while executing the method 'PrepareTarget' of service 'nms:delivery'.

SOP-330011 Error while executing the method 'PrepareTargetImpl' of service 'nms:delivery'.

DLV-490009 You have not defined the target population of the delivery action

Which is weird as I have defined the target to "operators" and assigned myself to the alert.

Any help would be welcome on this issue

Thanks a lot for your time.

Kenji Tsuchiya

Avatar

Community Advisor

Hello kenjit2993550​,

see the Amit Kumar​ 's comment in the Re: Use of variable in continuous delivery, how to do ?

That time I thought you can use instance variables in the delivery but the truth is I used them in the Alert message activity and not in delivery. You need to map instance variable to delivery variable as Amit wrote.

Hope this helps,

Marcel

Avatar

Level 2

Hi Marcel,

I am not using a delivery activity but an alert (as per the screenshots above) and it still does not seem to work.

Any ideas where it might come from? I am really struggling with this one.

Kenji

Avatar

Correct answer by
Level 10

Hi Kenji,

I have used a simple example to illustrate your case and it is working.

Step 1: use String when assigning xml value to a variable.

1538733_pastedImage_1.png

Step 2: use new XML to cast back a string to xml and use string to print the value of a variable.

1538732_pastedImage_0.png

if this doesn't work there will be something wrong with target mapping for your alert, try sending a static alert to debug that.

Regards,

Amit