Execute function for two minutes or until nested function responds true in Business central

Pablogrind
Member Posts: 13
Hi
I need execute TryCallData for two minutes or until GetPDF responds true
How can i do it in Business central?, Thanks
I need execute TryCallData for two minutes or until GetPDF responds true
How can i do it in Business central?, Thanks
procedure GetPDF(Bill: text) ReturnPDF: Boolean begin <Statement> end; procedure TryCallData() begin while not GetPDF('HMO986') do message('waiting...'); end;
0
Best Answer
-
Pablogrind wrote: »thanks @txeriff Is there a way to stop if loop takes more than 2 minutes?
Hi,
Not sure what you trying to run on GetPDF but if you want to wait 2 minutes try
getpdf('');
sleep(10800); //seconds
and thats it.
it won´t be time but I don´t want now to write you the whole code´(and time calculations are always pain), just use a counter :
vcounter:=0;
repeat
vcounter+=1;
until vcounter>=10800
for time:
vTime:=TIME;
SLEEP(3000); //wait 3 seconds
vTimeDec:=TIME-vTime;
MESSAGE(FORMAT(vTimeDec)); //time difference
1
Answers
-
Dear god, this is basic coding issue:
procedure TryCallData() var vFinished: boolean; begin vfinished:=false; repeat vfinished:=GetPDF('HMO986'); until vfinished=true; end;
0 -
thanks @txeriff Is there a way to stop if loop takes more than 2 minutes?0
-
Pablogrind wrote: »thanks @txeriff Is there a way to stop if loop takes more than 2 minutes?
Hi,
Not sure what you trying to run on GetPDF but if you want to wait 2 minutes try
getpdf('');
sleep(10800); //seconds
and thats it.
it won´t be time but I don´t want now to write you the whole code´(and time calculations are always pain), just use a counter :
vcounter:=0;
repeat
vcounter+=1;
until vcounter>=10800
for time:
vTime:=TIME;
SLEEP(3000); //wait 3 seconds
vTimeDec:=TIME-vTime;
MESSAGE(FORMAT(vTimeDec)); //time difference
1 -
Thanks @txeriff0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions