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).

  • +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.

  • 0 in reply to David Speck

    Thank you for the great explanation, David.  I followed the steps but each time I run the VI job I receive a "Job Perform failed in VENDOR_IPAY (ERR=12)...where VENDOR_IPAY is the name of my VI job.  I believe I followed all of your steps but have not been able to get past the error: 

  • +1 in reply to PRSpeed
    verified answer

    Were you able to confirm the latest revision worked for you?

  • 0 in reply to David Speck

    YES!!!  David, the revised code worked.  Thank you so much for your help.  Is there a way I can repay you for all your efforts?

    Thank you