Getting Started with CSPro


CSPro on census.gov

Download the latest versions of CSPro, CSEntry, and CSWeb. Watch CSPro videos and learn about upcoming U.S. Census Bureau workshops.

CSPro Help

CSPro Help is an excellent resource whether you are just getting started or an expert user. The help is available offline with an installation of CSPro or online at http://csprousers.org/help.

Popular Help Topics

CSPro Examples

CSPro Examples are a collection of data entry, edits & batch, and tabulation projects. Some projects are standalone, while others simply demonstrate common techniques. Here, you can see how the developers of CSPro design and code their applications. Feel free to use anything you see in these projects in your own project. The examples are an optional install. If selected they will be installed to your Documents folder under CSPro.

Debugging

Use of errmsg and trace

One of the most effective debugging tools at your disposal is the errmsg function. It can be useful to place them in PROCs, so you can see the order in which your application is executed. When this becomes burdensome, use the trace function. By enabling trace you'll see the execution of your application as it enters and exits each PROC. To see even more detail, set trace to output logic statements.

Has your application taken an unexpected path? Use trace in much the same way you would use errmsg to log the values of the conditional statement.

PROC GLOBAL

PROC DEBUGGING_FF

preproc

   
// Enable trace to see path of execution
    trace(on);

postproc

   
// Disable trace
    trace(off);

PROC ELIGIBLE

   
// Log user-generated information
    trace("AGE %d > 15 and SEX %d = 2", AGE, SEX);

   
// Begin outputting logic statements
    set trace;

   
if AGE > 15 and SEX = 2 then
       
skip to FERTILITY_FORM;
   
endif;

   
// Stop outputting logic statements
    set trace(off);

Use of Log Files

Log files expose a layer of detail otherwise unavailable.

Specifics of every synchronization will be written to the sync log. Depending on your OS you will find the sync log in either one of two places:

  • Android: csentry\sync.log
  • Windows: Users\username\AppData\Roaming\CSPro\sync.log

CSWeb makes use of two log files. These logs will only exist if you are using CSWeb:

  • csweb\logs\api.log
  • csweb\logs\ui.log

The API log records details related to the underlying RESTful API, while the UI log records actions related the navigation of the website.

Forum/Email

Need additional assistance? You can post questions to our forum at https://csprousers.org/forum. The forum has a couple of advantages. You may get a quicker response, because anyone in the CSPro Users community can respond. Also, it is likely someone has the same question as you, so it benefits the entire CSPro Users community to see the answer. As a secondary option, you can email the team at cspro@lists.census.gov. It is important to use the above email and not contact us directly. This helps us manage email support across our team.

Writing a clear question can be a challenge, but it is worth the extra effort. A clear question will lead to a quicker and more accurate response. Here are some tips to consider when writing your next question:

  • First, search the forum for an answer. Your question may have already been addressed.
  • Write a one sentence subject line in your forum post or email that summarizes the issue.
  • Start your post or email by expanding on your subject line and fill in necessary details.
  • Tell us how to reproduce the issue in bullet points.
  • If necessary, include just enough code to reproduce the issue.
    • This may be a snippet of code or a simplified application, but you should not be sending the entire application.
    • To prepare projects for attachment, use CSPack (Tools > Pack Application).
  • If useful, attach the appropriate log file (sync.log, api.log, or ui.log).
  • Proof-read your question--- is everything clear?
  • Finally, be prepared to answer follow-up questions when contacted by the team.

2016-03-02 Beta Release Notes


This is a beta release for CSPro 6.3. The future CSPro 7.0 release is going to introduce many changes, including a new way to store data, and it will have a significant impact on CSPro users. CSPro 6.3 is thus a release that builds incrementally off of CSPro 6.2 and may be the last release before the more significant CSPro 7.0 one. CSPro 6.3 introduces some new features and fixes some problems that were found in CSPro 6.2.

CSPro 6.3 is built with new versions of our programming tools, and this sometimes introduces quirks due to changes made by other parties. If you notice any unexpected behavior in CSPro 6.3, please email cspro@lists.census.gov. As part of this shift CSPro no longer runs on Windows XP machines.

We fixed a few bugs that users reported:

  • CSEntry taking a long time to redraw rosters on Windows.
  • Text Viewer crashing while opening a listing report.
  • The CSPro helps crashing when using the index on Windows 8 or 10.
  • The getos function not returning a correct value on Windows 10.
  • Underlines in question text not displaying correctly on Android.
  • Occurrence labels (set dynamically using setocclabel) not resetting when opening a new case.
  • Run as Batch not working when a data entry application used external logic files.

We are looking to streamline the CSPro language and other parts of the system. As part of this, in CSPro 6.3 we:

  • Removed the Convert Dictionary tool. It is now available on the Software page.
  • Removed the undocumented Android Wi-Fi peer-to-peer sync. If you used this, you should change your code to use Bluetooth instead.
  • Introduced deprecation warnings. If you are using features of the language that will no longer be supported in the future, you will see warnings when compiling your code. These can be controlled via the Options menu.

There are two new features in the CSPro Designer:

  • The position of the Designer window is saved and restored the next time you open CSPro.
  • If you want to view both names and labels at the same time, you can select View -> Append Labels to Names in Tree.

20160302 appendLabels

There are a couple enhancements for the Android CSEntry app:

  • The note icon appears blue when the field has a note, which is a nice way for the interviewer to know if they have left a note on the field.
  • A Review All Notes feature displays all of the notes for a case, allowing interviewers or supervisors to easily navigate to fields with notes. To access the feature, long-press on the notes icon or find the option off the menu button.
  • Help text defined for a field is now accessible and the interviewer can toggle between the question and help text.

20160302 help

There are a couple enhancements to the CSPro language:

  • You can use a negative index to get a substring starting from the right side of the string. For example: "JOANNA"[-4] returns "ANNA"
  • You can declare a numeric variable at the beginning of a do loop. In this case, the variable's scope will just be the duration of the loop.

    do numeric ctr = 1 while ctr <= totocc(PERSON_REC)

  • Savepartial has an optional parameter, clear. If used, the information in skipped fields will be cleared before the case is partially saved. Savepartial with clear simulates the behavior when a case is saved normally in system-controlled mode.
  • User-defined functions can now call themselves, meaning that recursion is now possible.
  • User-defined function pointers can be passed as arguments to other user-defined functions. For examples of this (and recursive functions), see the "Additional Examples of Functions" link at the bottom of the help page for functions.

There are three new CSPro language functions:

  • uuid: this function returns a string representing a universally unique identifier (UUID). This, a GUID, can be used if you need to uniquely identify something, as the odds of the function returning the same string twice are infinitesimally small.
  • loadsetting and savesetting: these functions allow you to store information as attribute-value pairs. The information is stored separately from any given application and thus can be shared between applications. These functions allow you to easily pass information between programs rather than needing to write information to a text file, external dictionary, or the parameters section of a .pff.

2015-11-12 Beta Release Notes


This is intended as the final beta before the CSPro 6.2 release.

Major new features:

  • Multiple language dictionaries: Select Edit->Languages in the dictionary editor to add languages to your application. Unique labels can be added in each language. When creating forms, the "link field label to dictionary item" drag property ensures that the field labels will be modified when the dictionary language is changed, keeping the labels in sync.
  • Value set images have now been fully implemented on both Windows and Android environments. The file formats supported include: .jpg, .gif, .bmp, .png, and .tif.
  • Applications can define resource folders that contain auxiliary files that the application uses. These files will be compressed in the .pen file and decompressed when running the application.

Minor features:

  • Android case tree changes: individual fields can be hidden in the tree; by default skipped fields will no longer be shown in the tree.
  • Windows extended controls have been improved, with navigation buttons and search functionality.
  • System messages as defined in CSProRuntime.mgf can be overridden.
  • File handlers can now be passed as arguments to user-defined functions.
  • The Android application can now be installed to a device's SD card.
  • Dictionary Macro options for compacting and sorting data files, as well as an Open With (CSPro tool) option.

New logic functions:

  • prompt: Prompts the operator to enter an alphanumeric string, also supporting a password masking option.
  • round: Returns a value rounded to the nearest integer.
  • connection: Determines whether the device has access to the Internet.
  • getimage: Returns the filename of a value set image.

2015-03-20 Beta Release Notes


(View the previous beta release notes, from 2015-02-04.)

Release Notes for 20 March 2015

  • The Android case tree now uses colors to show whether a field has been entered, skipped, etc., as on the desktop (though with different colors).
  • The synchronization routines now support peer-to-peer syncing using Bluetooth. (This is in addition to the current Dropbox and FTP synchronizations.) When using Bluetooth sync, you set one device as the "server" and the other as a "client." The server has no intelligence, and it is the client's responsibility to get and put the appropriate files. For an example of Bluetooth sync, see this simple Bluetooth sync demo where one file is sent from the client to the server. For a more advanced example, run the CSEntry File Transfer application.
  • Checkbox fields are now easier to work with because the alpha field no longer needs to be the combined length of all possible selections. For example, if you have 10 selections and each selection is 1 character, you no longer have to make the alpha field length 10. You could make it length 3, and that would support 3 selections. This also makes it easier to use checkboxes with dynamic value sets. For an example of this (as well as using lookup files), run this Population Projector application.
  • The display of the Android case tree can be turned off (e.g., for a menu program) from Data Entry Options.

2015-02-04 Beta Release Notes


(View the previous beta release notes, from 2015-01-17.)

Release Notes for 4 February 2015

  • A new logic function, publishdate, returns the date and time that the code was compiled. This value can be used to determine when your .pen file was created.
  • Users can now search the case tree on Android devices.
  • Small improvements and bug fixes, including fixing a bug that caused CSEntry to crash on some Android devices, including many 7" tablets.
  • If you want to create .pen files from the command line (e.g., in a batch script), then you can write:

    "%ProgramFiles(x86)%\CSPro 6.0\CSEntry.exe" /pen "My Program.ent"

    On a 32-bit machine, remove the "(x86)" from the above code.