Reports can be saved programmatically using DMIS Menu - Save Commands as shown below:
Clear Report: Creates the following DMIS commad which clears the existing report page.
Save Report: Opens saving report options dialog as shown below:
Report View: Sets the report view to one of Classic, Gird or HTML views. For more info about report styles, see User Manual's Reporting section.
Report Style: Sets the report style. For more info about report styles, see User Manual's Reporting section.
Query The Operator Check Box: Once checked, during the program execution prompts a dialog for the operator to enter file name.
Browse Button: Opens the dialog below where the operator enters a filename and browses the directories to set a location to save the report file.
Using Save as Type, a file format should be selected from the list as shown below.
Important Note: Any format that requires Microsoft Excel, requires a Microsoft Office installed on the PC where Capps is running.
Action If File Already Exists: If the file already exists in the given location Capps will do one the following options to save the report file:
1) Overwrite: This will overwrite the existing file and updates the information with the latest report outputs. Data from previous program executions won't be saved.
2) Increment File Name: Adds an incremental number at the end of the file name each time a new report file is created. That way all the previous report files will also be available under the same directory.
3) Append (Excel Files): This option is only available for two of Microsoft Excel formats (.xls and .xlsx). It will append the new report outputs at the end of the existing file, after each program execution. Using this option all the data from previous run will also be stored in the same file.
Once all the information are entered in the dialog, Capps will insert a DMIS command to automatically save the report when the program execution reaches that point as shown below:
Alternatively, report file name with the specific file extension and file path can be defined in a program using variables. That way the file name, file extension and file path can be altered during the execution of the program. Below is an example of such program:
First start with declaring the string variables to store the following information:
We can use OBTAIN/KEYBRD command to store file name into FILE_PATH by prompting it to operator during program execution as follows:
File extension for the report file has been hard coded as shown below. Remember to enter the value between single quotes and start extension name with . followed by lower-case letters:
File path can also be hard coded as shown below:
Important Note: Capps does not create new folders under an existing path. Please make sure the folder your path is pointing to exists, before executing your program. Otherwise, Capps neither create a new folder under a given path, not save the report file.
Back slash character is also saved to a variable as shown below:
In order to store the the full path for the report file, all the variables are combined together using CONCAT command as shown below:
The report is saved with an INCREMENT option, which means the file name is going to be incremented by one, after each program execution.
Important Note: In order to use the path stored in FULL_PATH variable it must be preceed with @ sign between single quotes as shown below:
You can copy and paste the code from the attached file to any test program to see how it works in action.
Important Note: If you are running the attached code using CappsNC please make sure to uncheck Simulate option, prior to running the program as shown below: