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

Deb007
Level 6
Level 6

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
Malarrajan_Sundarraj
Correct answer by
Level 3
Level 3

Hi @Deb007 

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

File Name: funcList.xml

 

- Malarrajan Sundarraj

View solution in original post

10 Replies
Manoj_Kumar_
Community Advisor
Community Advisor

Hello @Deb007 

 

You can find them under Admin>config>javascript codes

 

 

Deb007
Level 6
Level 6

By any chance you know the js file name?

I had no luck finding the one.

 

Thanks,

Deb

ShrawanSaxena
Level 4
Level 4

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

Deb007
Level 6
Level 6

I am looking for definition of WeekDay() function.

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

 

Cheers,

Deb

ShrawanSaxena
Level 4
Level 4

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

Deb007
Level 6
Level 6

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

Malarrajan_Sundarraj
Level 3
Level 3

Hi @Deb007 ,

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

Deb007
Level 6
Level 6

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

Malarrajan_Sundarraj
Correct answer by
Level 3
Level 3

Hi @Deb007 

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

File Name: funcList.xml

 

- Malarrajan Sundarraj

View solution in original post

LaurentLam
Level 6
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