set access(dictionary_name, type.valueʃ, type.value, ...ʅ);
The set access
statement is used to control the way that CSPro iterates through a data file. By default, CSPro processes all non-deleted cases in file order for the main input file of a batch application or in ascending key order (e.g., A -> B -> C) for all other files. With this statement, you can change the default behavior to process cases in a different order or to control what cases are processed.
The dictionary_name refers to either an external dictionary or the main input file of a batch application. If the dictionary access parameters are modified while in the middle of iterating through the data file, the next case loaded will be based on the location of the currently loaded case. For example, if you are running a batch application on cases 1 to 5, and then after processing case 3 you change the order to descending, the next cases loaded will be 2 and 1.
|OrderType||Indexed||Iterate based on the alphabetical value of the case's key (default for external dictionaries)|
|Sequential||Iterate based on the case's position in the file (default for batch inputs)|
|Order||Ascending||Iterate from low to high value (key or file position) (default)|
|Descending||Iterate from high to low value (key or file position)|
|CaseStatus||All||Iterate through all cases, including deleted cases|
|NotDeleted||Iterate through all non-deleted cases (default)|
|Partial||Iterate through non-deleted partially saved cases|
|Duplicate||Iterate through non-deleted cases where there are at least two cases with the same key in the file|
Using set access
, the dictionary access parameters are modified until the next call to set access
. However, it is also possible to temporarily change the dictionary access parameters when using several functions or statements. By specifying the parameters in parentheses after the dictionary name in uses of countcases
, and selcase
, the access to the dictionary will only be changed for the duration of that routine.
An additional parameter that can be used with these functions is startswith
, functionality that allows for partial iteration of only cases with keys that start with the specified key prefix.
// process the batch input in order from the last province to the first
set access(CENSUS_DICT, OrderType.Indexed, Order.Descending);
// only process assignments in the area where the supervisor is working
forcase GEOCODES_DICT(startswith, strip(MENU_GEOCODE_SELECTION)) do