Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cognoscript: Days between now and then

Status
Not open for further replies.
Jul 19, 2003
132
NZ
I want to add to my Cognos script the ability to run a report every pay day.

I figure I want to perform a test something like:
if (days between today and a hard coded payday)/14 = a whole number then true else false

I'm not sure what the correct syntax would be, can anyone help?

Thanks.

Bruce
 
Bruce,
The problem in CognosScript is that it lacks (or it does in my version) any DateDiff or Interval calculation functions.

So, one way to do it would be to carry on deducting 14 days from the current date until that date is lower than the pay date.
Code:
strdate = Cvar(date)
strpayday = "1/25/2005"  'example paydate m/d/yyyy
flag=0
count=0
Do while strdate > strpayday 
strdate = Cvar(date)-(count*14)
If strdate=strpayday then flag =1
count = count+1
Loop
After exiting the loop, testing the value of 'flag' will determine whether your report should run.

soi la, soi carré
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top