When CSPro has an interface for a tool, I suggest that you use the interface as much as possible, but on occasion a user might want to write code for more advanced functionality. One such example is when writing code for advanced export operations.
The CSPro help documents include some information on the export statement, but I often forget the syntax or what exactly the parameters should be. Fortunately, now with CSPro 4.1.002, a feature of the Export Data tool allows you to view the code that powers the export. By selecting Options -> Copy Logic to Clipboard, you can then take the export logic and insert it in the batch application of your choosing. This is a nice way to quickly get the basic export code needed and then you can build off of that.
For an example of a batch export that uses a lookup file, imagine that I have a data file describing stores and their customers. One of the attributes of a customer record is a country code that describes where the customer lives. When exporting the names of the customers, I do not want the two-letter country code, but the full name of the country. Using this list of country codes as a lookup file, I would go into the export tool, select the fields that I want to export, and then after copying the logic to the clipboard I would see code like this:
I would insert this code into a new batch application, add my lookup file code, and I would end up with something like this:
This feature in the Export Data tool vastly simplified my task, allowing me to focus on the lookup file programming, rather than the syntax of the export statement. My exported file now contains data from two files:
500 Pastry Pantry Barack Obama US United States
500 Pastry Pantry Angela Merkel DE Germany
500 Pastry Pantry Hu Jintao CN China
800 Chocolate Heaven Jacob Zuma ZA South Africa
800 Chocolate Heaven Alexander Lukashenko BY Belarus
This is the input file:
20500Barack Obama US
20500Angela Merkel DE
20500Hu Jintao CN
20800Jacob Zuma ZA
20800Alexander Lukashenko BY