DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Select FileImportFilter on UserCommand Navigator.Events.OnFileLoading.

Solved!
Go to solution

Hello,

 

I am trying to select the 'FileImportFilter' to be used at the moment of loading certain data using a script. For that, in the UserCommand defined to the event 'OnFileLoading' (triggered before the data is loaded)  I am saying:

Sub MyOnFileLoading (NaviLoadControl, DataFileName, ImportAction, FileImportFilter, ImportSelection)

Select Case LCase(NameSplit(DataFileName,"E"))

      Case "mfx"

     FileImportFilter="MDF4"

      Case Else

 End Select

However, the data is not loaded and the message box for selecting one of the data plugins availables is shown.

Can anyone help me with this? There is other way to select the data plugin to used before the loading of a data starts?

 

Thank you,

Andres Uribe 🙂

 

 

 

0 Kudos
Message 1 of 3
(2,950 Views)

Hi Andres,

 

Do you have the DataPlugin installed for the MDF4 file? This is not one of the native values of the variables.  Additionally, if you are using the Recording mode, you can open the file with the appropriate filename extension in the Open dialog box to specifiy the value of the FileImportFilter.

 

Variable: FileImportFilter

http://zone.ni.com/reference/en-XX/help/370858M-01/varoff/fileimportfilter/

Regards,

Jake H
Applications Engineer
0 Kudos
Message 2 of 3
(2,911 Views)
Solution
Accepted by AndresUribe

The given parameters are only input parameters.

The idea is that you can prepare something inside DIAdem before loading.

There is the capability to avoid the loading by setting

NaviLoadControl = "SkipLoadCmd"

It is important to be careful with this option because afterwards DIAdem might behave currious in some scenarios.

 

So if you intend using it your code has to look like

Option Explicit

Call AddUserCommandToEvent("Navigator.Events.OnFileLoading","MyOnFileLoading")

Sub MyOnFileLoading (NaviLoadControl, DataFileName, ImportAction, FileImportFilter, ImportSelection)
  Select Case LCase(NameSplit(DataFileName,"E"))
    Case "mfx"
      if "" = ImportSelection then
        call DataFileLoad(DataFileName, "MDF4", ImportAction)
      else
        call DataFileLoadSel(DataFileName, "MDF4", ImportSelection, ImportAction)
      end if
      NaviLoadControl = "SkipLoadCmd"
    Case Else
  End Select
End Sub
0 Kudos
Message 3 of 3
(2,905 Views)