Wait for activity to finish before next FOR loop

Michael Houlberg michael at houlbergdevelopment.com
Fri Jul 22 17:47:25 UTC 2022


Martin,

I’ve just started doing the same thing.  I use $cinst.$run instead of $cinst.$start to run it in the main thread.  In this way, it isn’t a background process which is what’s causing the problem.

Michael Houlberg
Houlberg Development, LLC

Sent from my iPad

> On Jul 22, 2022, at 10:10 AM, Martin Obongita via omnisdev-en <omnisdev-en at lists.omnis-dev.com> wrote:
> 
> Hi $Listers,
> I have a FOR loop that runs through a list and sends emails.The problem I have is that the next line in the list is loaded and sent before the previous line has finished emaling.Therefore the email process is cancelled.
> I'm short of wits on how I could delay or check for a flag to indicate that the process has finished before the next FOR loop begins.
> $construct
> Calculate iFileListLineCount as lFileList.$linecount
> 
> For iFileListLineNum from 1 to iFileListLineCount step 1
> 
> Calculate iToReceiver as lFileList.[iFileListLineNum].email
> 
> Calculate iPath as lFileList.[iFileListLineNum].FilePath
> 
> Calculate iFilename as lFileList.[iFileListLineNum].name
> 
> Do $cwind.$setFileListInfoRow(iToReceiver,iPath,iFilename)
> 
> Do $cinst.$start
> 
> End For
> 
> As you can see from this method, the next FOR loop will run before the DO $cinst.$start is complete.
> I have read the documentation and I'm not sure if I could use Object Reference.Has anyone used ObjRef in this case or there is a cleaner code that can solve this?
> Kind regards,Martin O.
> _____________________________________________________________
> Manage your list subscriptions at https://lists.omnis-dev.com
> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com 



More information about the omnisdev-en mailing list