There are times when we would like to keep a Standard Datapath from running. A typical scenarios is when using a multi-step workflow process, where exports should only occur when the last user completes the form. To accomplish this you can add some code that looks like this to the SeverQueueing event in the script editor of the form:


<MiCode(FormScriptEventType.ServerQueuing)> _

Public Sub Form_ServerQueuing(ByVal e As ServerQueuingEventArgs)


'' This code turns off all datapaths by pretending they are already complete

For Each dp As DataPath In _form.DataPaths

   dp.Complete = True

Next


'' This code ensures all datapaths will run by telling the form that they have not completed

For Each dp As DataPath In _form.DataPaths

   dp.Complete = False

Next


'' Finally, if you have multiple datapaths that may need to run at different points in workflow you can use comparison operators to specify specific ones to turn on like so:

For Each dp As DataPath In _form.DataPaths

   If dp.Name = "PDF" Then

    dp.Complete = True

   End If

Next


End Sub