Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

JavaScript Functions in Expression Editor

Avatar

Community Advisor

Hi,

I would like to know where the js functions present in expression editor in workflows are defined. Need to look into some OOTB functions.

I could find some sql functions in Admin->Config->SQL that corresponds to the js functions, but couldn't locate the js function definition.

Any help/hint is appreciated.

 

Thanks,

Deb

1 Accepted Solution

Avatar

Correct answer by
Level 3

Hi @Deb_Tripathy 

File path : <Campaign_Installed_location>\datakit\xtk\eng

File Name: funcList.xml

 

- Malarrajan Sundarraj

View solution in original post

5 Replies

Avatar

Community Advisor

Hello @Deb_Tripathy 

 

You can find them under Admin>config>javascript codes

 

 

Avatar

Community Advisor

By any chance you know the js file name?

I had no luck finding the one.

 

Thanks,

Deb

Avatar

Employee

Hi Dev,

which OOB function you are looking for ? Functions definitions are present in database specific files .

For example all postgres related functions are defined inside xtk:postgresql-functions.sql

Avatar

Community Advisor

I am looking for definition of WeekDay() function.

I couldn't locate that in xtk:postgresql-functions.sql.

 

Cheers,

Deb

Avatar

Employee

Hi Dev,

Let me check on this function definition code .

 

Please find below how weekday works:

 

WeekDay(date/datetime)

Returns the number of day in the week following the rule: 0=Monday ...
6=Sunday.

 

In case argument is of type datetime - day of the week is calculated from time in client's timezone (timezone is passed to server in query). Otherwise, if argument is of type date, day of the week is calculated in timezone agnostic manner.

 

Example

WeekDay(#2021-09-22 00:34:56Z#)=2

Avatar

Community Advisor

Thanks @ShrawanSaxena  for your hep.

But did you get this function definition any where in Adobe Campaign, like in any JS or SQL?

 

Cheers,

Deb

Avatar

Level 3

Hi @Deb_Tripathy ,

The fucntion defination in the back end file. It wont be available in the Client console.

For PostgreSQL: 

mod(cast(Extract(dow FROM $tz1) as integer)+6, 7) // $tz1 -> Data with timestamp

  

 

- Malarrajan Sundarraj

Avatar

Community Advisor

Thanks @Malarrajan_Sundarraj .

At least, It is clear that cant be accessed from console.

May I know the server file name and location?

 

Cheers,

Deb

Avatar

Correct answer by
Level 3

Hi @Deb_Tripathy 

File path : <Campaign_Installed_location>\datakit\xtk\eng

File Name: funcList.xml

 

- Malarrajan Sundarraj

Avatar

Level 6

It's impossible: expressions from workflows (and that appears in the nlClient UI) are only pure SQL translation expressions... You will never find any JS dedicated expression in it:
low level expression are ran directly on the DB layer. higher level expression (from JSAPI) are ran on the JS engine layer (on top of the DB layer)

If you need to add new SQL expression, you can use this documentation:
Ajout d'autres fonctions SQL | Adobe Campaign