When using the Windows Client, Mi-Forms is capable of having a form host a number of subforms as seen in DuckPond.mfd in the examples folder of Mi-Forms Designer.


In this case you can have your subform instances run their own datapaths separate from the ones in the main form. In practice they do not run by default without some extra help in the form of .NET scripting.


To make datapaths in subforms run, you will want to iterate through the subform sessions in the AfterDataPathsRun event on the main form. If there are more than one defined datapath in your subform you will also need to iterate through those to ensure they all run. The following code shows a simple example of this in action:

         

<MiCode(FormScriptEventType.AfterDataPathsRun)> _ 
Public Sub Form_AfterDataPathsRun(ByVal e As AfterDataPathsRunEventArgs)
	' Run datapaths In subforms 
	If e.Scope = MiCo.MiForms.DataPathScope.Server
		Dim dpem As DataPathExportModule = New DataPathExportModule 
		For Each sfs As SubformSession In _Form.SubformSessions 
			For Each sfdp As DataPath In sfs.Form.DataPaths
				If sfdp.Complete = False Then  
    					dpem.ExportDataPath(sfs.LoadedForm, sfdp) 
    				End If 
			Next 
		Next
	End If  
End Sub

         

You may note that we are filtering the resultant DataPaths with the .Complete property. This ensures that your DataPaths will not run more than once:

 

If sfdp.Complete = False Then 

 

Also, I am assuming that the DataPaths in the SubForms are going to run on the server, or with a Scope of Server. This could just as easily be set to a Scope of Client:

    

If e.Scope = MiCo.MiForms.DataPathScope.Server Then