Agent with @business day

Dear All,

I am trying to solve one problem in which user wants one agent and that agent will run after 14 working day of creation date.

Exaample : creation date is 14-02-2014 then then need to calculate 14 working days and after calculation agent should run on that calculated date.

I did like this :

created one new computed field(businessday) and trying to using @business formula in this field I will take calculated 14 working days date in this field and write agent and compare that date to current date then agent will run, but i am not able take the 14 working days date value in this field. first time i am using @businessday formula therefore facing some problem

here datum is creation date field and value in this field is 14-02-2014

today:=@Today;

@if(@businessDays((Datum);today;1:7)=14);

@Prompt([Ok]; “Yes”;“Not Ok”)

please suggest

Subject: agent with @business day

If it is a scheduled agent, just run the agent every day, and have it processed any unprocessed documents.

You can then, for each document, check the age in business days and perform whatever action you like.

I would write that logic in Lotusscript, by the way.

Subject: RE: agent with @business day

Hi Karl thanks for your reply… yes I dont have any problem in agent…but problem in calculation of business day…

yaa script is fine… in script i guess we can use weekday…

if you dont have any prob could please share you logic with me, if it is fine with you.

Subject: RE: agent with @business day

Nothing complicated, there are multiple ways to do it.

Here is a quick hack. You should of course add error handling, perhaps modify the code to accept the date in different formats/different data types, etc.

%REM

Function BusinessDays

Description: Calculate number of weekdays/bsuiness days between two dates

%END REM

Function BusinessDays(startdate As String, enddate As String) As Integer

Dim sdate As Double

Dim edate As Double

Dim n As Double

Dim bdays As Integer 



sdate = CDat(startdate)

edate = CDat(enddate)

bdays = 0

For n = sdate To edate

	If Weekday(n)<7 And Weekday(n)>1 Then

		bdays = bdays + 1

	End If 

Next 

BusinessDays = bdays

End Function