APP003.TXT TestPoint Application Note APP003.TST Associated Source File (c) Capital Equipment Corporation 1995 ________________________________________________________________ Variable File Names or "Can I create multiple files and assign them names within my application? ________________________________________________________________ Opening, writing and reading multiple files where the file names are dependent on the test data, a loop count, or a user input is a common requirement. TestPoint handles this easily. This example uses four objects - a data entry field, a single file object to control multiple files, a math object to do string concatenation and a loop to determine the number of files created and the file name suffix. Drag a data entry field and then a file object to the panel. Drag the file object to the Action List three times, selecting "Set filename of" then "Output to" and finally "Close". Select a math object and set the formula equal to "initial & count". The "&" operator is used to concatenate a string variable which will be the suffix of the file name. An initial file name can be provided in the data entry object for convenience and to act an example for the type of information required. Drag the math object to the top of the Action List and select calculate. Drag the data entry object to the initial= box. Select a loop object and drag it to the top of the Action List. Drag the end of the loop to the bottom of the Action List. Drag the loop name Loop1 to the variable which will set the suffix of the file name in line 2. Drag the math object from line 2 to line 3 so that the result of the calculation will become the new file name. Enter or drag some data to line 4 for output to your files and you're done! The number of files generated and their names will be based on the number of the loop count. Refer to the TestPoint source file to see the completed application.