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!

How to make cognos macro wait?

Status
Not open for further replies.

thampik

Programmer
Mar 5, 2003
8
US

In a cognos macro that I am writing, it needs to check if a certain event has occured and it the even has not occured, the macro has to wait for 10 minutes and check again.
Is there a statement in CognosScript that will make the macro wait for a certain time before executing the next statement?

Thanks
Thampi
 
A simple processor dependent delay loop is:

for delay = 1 to 500000 'Change value to change wait
next delay

Speed will depend on how fast your computer is, but for 10 minutes I would start with about 50000000 and adjust from there.

I have a processor independent delay loop around here somewhere, and when I find it I'll post it as well.

Regards,

Dave Griffin
The Decision Support Group
Reporting Consulting with Cognos BI Tools
"Magic with Data"
[pc2]
Want good answers? Read FAQ20-2863 first!
 
Thanks.
I shall this loop for now since the wait time is not critical.

Thanks again
Thampi
 
Hi Griff,

How to use this delay in Macro?I also need the solution for the same case in macro.

Regards
Coglearner
 
You can also use the sleep function. Let me know if the syntax can't be found and I'll post it.

flex
 
Try:

FUNCTION Delay(secs%) '[2]
X = TIMER
DO WHILE TRUE
Y = TIMER
IF Y-X > secs% THEN
EXIT DO
END IF
LOOP
Delay = 0
End Function

This delays in seconds and is processor-independent.

Regards,

Dave Griffin


The Decision Support Group
Reporting Consulting with Cognos BI Tools
"Magic with Data"
[pc2]
Want good answers? Read FAQ401-2487 first!
 
This is the command that I was talking about and let's you bypass any loops.

Declare Sub Sleep Lib "kernel32" Alias "Sleep" (ByVal dwMilliseconds As Long)

sub main()
'To call the Sleep function, you could use code like the 'following:
' sleep for 3 seconds
Call Sleep (3000)

end sub

flex
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top