Is there a way to add a record count at the end of a VI export job

SOLVED

I am trying to run a VI job that contains a record count at the end of the file being exported.  However, I don't know if there is a way to do this within Visual Integrator (using Sage 100 v2018).

Parents
  • +1
    verified answer

    Add perform logic to the "On Completion" perform type.

    In the command, you need to specify a file that will contain the perform logic.  I recommend placing it in the MAS90\CM\Script folder.  

    Make sure the file name you reference in the Command matches the file name exactly as it appears in Windows Explorer.  You may need to enable the option to view file extensions to avoid ending up with a file like "VI_AppendRecordsExported.pl.txt".

    Add the following to the file you referenced in the Command.

    WDX_Option$=coSession'WDX$
    If ImportFileOnHost$="Y" Then WDX_Option$="" End_If
    ImportFileName_chan=HFN
    DEF ERR=0
    OPEN LOCK(ImportFileName_chan,ERR=*NEXT)WDX_Option$+ImportFileName$
    IF ERR<>0 THEN Error_Msg$=SEP+MSG(ERR)+SEP+"Line: "+STR(ERS)
    IF ImportFileName_chan=LFO THEN {
    	WRITE RECORD (ImportFileName_chan)"Records Exported: "+STR(RecordsPassed)
    	CLOSE(ImportFileName_chan)
    }
    

    The result.

    You can edit what gets written to whatever you want, just change what comes after WRITE RECORD (ImportFileName_chan).  Strings must be enclosed in double quotes and numeric values must be converted to a string by wrapping it in the STR function.  RecordsPassed is a numeric variable that holds the number of records selected to be exported.

Reply
  • +1
    verified answer

    Add perform logic to the "On Completion" perform type.

    In the command, you need to specify a file that will contain the perform logic.  I recommend placing it in the MAS90\CM\Script folder.  

    Make sure the file name you reference in the Command matches the file name exactly as it appears in Windows Explorer.  You may need to enable the option to view file extensions to avoid ending up with a file like "VI_AppendRecordsExported.pl.txt".

    Add the following to the file you referenced in the Command.

    WDX_Option$=coSession'WDX$
    If ImportFileOnHost$="Y" Then WDX_Option$="" End_If
    ImportFileName_chan=HFN
    DEF ERR=0
    OPEN LOCK(ImportFileName_chan,ERR=*NEXT)WDX_Option$+ImportFileName$
    IF ERR<>0 THEN Error_Msg$=SEP+MSG(ERR)+SEP+"Line: "+STR(ERS)
    IF ImportFileName_chan=LFO THEN {
    	WRITE RECORD (ImportFileName_chan)"Records Exported: "+STR(RecordsPassed)
    	CLOSE(ImportFileName_chan)
    }
    

    The result.

    You can edit what gets written to whatever you want, just change what comes after WRITE RECORD (ImportFileName_chan).  Strings must be enclosed in double quotes and numeric values must be converted to a string by wrapping it in the STR function.  RecordsPassed is a numeric variable that holds the number of records selected to be exported.

Children