Expand my Community achievements bar.

We are excited to introduce our latest innovation to enhance the Adobe Campaign user experience — the Adobe Campaign v8 Web User Interface!

What does $ mean?

Avatar

Level 3

Can anyone tell me what the php code ($) in the following documentation and elsewhere in AC documentation, mean?

Is it php? If so, why is php embedded there? I thought Adobe Campaign does not process php.

If not php, what is it? JavaScript? XML? What does it mean; I believe it is an assigned value, but I am trying to find it's origin (whether it's php, js, or xml. Can't find it online, other than php.):

php.png

5 Replies

Avatar

Employee

Hi Jae,

It looks like xpath rule . XPath is a query language which is being used for selecting nodes from an XML document.

The XPath language is used in Adobe Campaign to reference an element or attribute belonging to a data schema. XPath is a syntax that lets you locate a node in the tree of an XML document. Elements are designated by their name, and attributes are designated by the name preceded

You can go through below link to know more on this

https://forums.adobe.com/thread/2406917

https://stackoverflow.com/questions/13537066/what-is-the-purpose-of-in-xslt

Avatar

Level 3

Hi,

Adobe provides documentation on developing and importing custom functions:

https://docs.campaign.adobe.com/doc/AC/en/CFG_API_Adding_additional_SQL_functions.html

customfunction.png

This is the sample function raw code that Adode provides above:

<function name="relativeMaturity" type="long" args="(&lt;Âge&gt;)" help="Returns the difference between a date and 18 years" minArgs="1" maxArgs="1" display="Relative maturity of the person born on the date $1">

body="extract(year from age($1))-18"/>

So I've developed the following vlookup function:

<function name="vlookup" type="long" args="(&lt;vlookup&gt;)" help="Vertical (v)lookup searches down the first column of a range for a key and returns the value of a specified cell in the row found" minArgs="4" maxArgs="4" display="Vlookup will define based on four (4) arguments ($1, $2, $2, $4)">

body="vlookup($lookup_value, $Table_array, $Col_index_num, $Range_lookup)"/>

So is the xpath syntax correct:

body="vlookup($lookup_value, $Table_array, $Col_index_num, $Range_lookup)"/>

Or is it:

body="vlookup($1lookup_value, $2Table_array, $3Col_index_num, $4Range_lookup)"/>

...with "$" plus number, as in "$1lookup_value" or it just $ without the number, as in: "$lookup_value"?

Avatar

Level 10

Hi,

From what's described in the docs, I understand that "$1" corresponds to the first argument of the function (in 'args' attribute).

In the sample function, we see that there is only one argument, which is the &lt;Age&gt;, called further in the sample's body by $1, where "extract(year from age($1))-18" is understood by the database engine.

So I assume that to call $2, $3, etc, there would need to be the same number of arguments (= values passed by the user to execute the function).

And then in the body attribute, you'd detail the function implementation from the database point of view and call your arguments with "$1", "$2", etc. So $1abcd or $abcd are both incorrect in the body, simply $ followed by the number of the argument to use.

In your own function, you have only 1 value in "args", so you can only call $1 in the body of your function.

Don't know if that's really clear but hope it helps,

Florent

Avatar

Level 3

Hi,

Thank you for the reply. I think your reply's accurate.

So the body script for the vlookup function as I have it:

body="vlookup($lookup_value, $Table_array, $Col_index_num, $Range_lookup)"/>

is incorrect. As the vlookup as 4 arguments, the body script should be instead:

body="vlookup($1, $2, $3, $4)"/>

And during the function call, I would simply pass the column fields or xpath name that corresponds to each argument, i.e., since the vlookup syntax is:

vlookup(lookup_value, Table_array, Col_index_num, Range_lookup)

I would pass the table attributes, lookup_value to $1, Table_array to $2, Col_index_num to $3, and Range_lookup to $4, correct?

Avatar

Level 10

Yes this is how I understood the docs. That said, in "body", you have to make sure that your database engine knows and can process 'vlookup' (I don't know much about that). If yes, then you should be good to go.

Florent