Solved

custom expression to use when scheduling an App Task

  • 1 September 2022
  • 4 replies
  • 200 views

Badge +4

Can someone provide an example of a custom expression to use when scheduling a Run Application Server Task?  I have a task that should run WEEKLY ON MON AT 17:00 but if Monday is a Holiday I want it to run on TUES.  Our holidays are defined in work_time_exception_code.

icon

Best answer by CallumW 2 September 2022, 15:02

View original

4 replies

Userlevel 7
Badge +31

Hi @anntarr,

You are supposed to use Oracle expressions that return a date/time value as the expression. SQL statements are not allowed as a custom expression. However a function call which returns a date value can be used.

Eg:

Instead of using...

select DATE_FROM 
from IFSAPP.ACCOUNTING_PERIOD t
where t.COMPANY = '10' AND t.ACCOUNTING_YEAR = '2016'
AND ACCOUNTING_PERIOD = 1;

...the function call given below can be used:

ACCOUNTING_PERIOD_API.Get_Date_From(10,2016,1);

So I think you can create a Util package in the database and write a function to return the date as you need and then use that function as the expression. 

Following post has an example expression using Oracle expressions:

Hope this helps!

Userlevel 5
Badge +15

Hi @Charith Epitawatta 

 

It depends if we are talking about Application Server Tasks or Database Tasks.

For the second, Oracle scheduler settings are acceptable:

https://docs.oracle.com/database/121/ARPLS/d_sched.htm

ex: FREQ=MONTHLY;BYDAY=1SUN;BYHOUR=12

Userlevel 6
Badge +15

Give this a try: 

 ifsapp.work_time_calendar_api.Get_Next_Work_Day('*', next_day(SYSDATE, 'MONDAY' )-1)+ (1020/60/24)

Just change * to the name of the Calendar you are using linked to the exceptions.

Badge +4

Thanks, that worked!

Reply