• <GetStart>
  • CSPro User's Guide
    • The CSPro System
    • Data Dictionary Module
    • The CSPro Language
    • Data Entry Module
    • Batch Editing Applications
    • Tabulation Applications
    • Data Sources
    • CSPro Statements and Functions
      • Statement Format Symbols
      • Alphabetical List of Functions and Statements
      • List of Reserved Words
      • Deprecated Features
      • Declaration Statements
      • Symbol Functions
      • Item Functions
      • Array Object
      • Audio Object
      • Barcode and QR Codes
      • Case Object
      • Document Object
      • File Object
      • Freq Object
      • Geometry Object
      • HashMap Object
      • Image Object
      • List Object
      • Map Object
      • Path
      • Pff Object
        • Pff Statement
        • Pff.load Function
        • Pff.save Function
        • Pff.getProperty Function
        • Pff.setProperty Function
        • Pff.exec Function
      • SystemApp Object
      • ValueSet Object
      • Program Control Statements
      • Assignment Statements
      • Data Entry Statements and Functions
      • Batch Edit Statements
      • Numeric Functions
      • String Functions
      • Multiple Occurrence Functions
      • General Functions
      • Date and Time Functions
      • External File Functions
      • Synchronization Functions
    • Templated Reporting System
    • HTML and JavaScript Integration
    • Action Invoker
    • Appendix
  • <CSEntry>
  • <CSBatch>
  • <CSTab>
  • <DataViewer>
  • <TextView>
  • <TblView>
  • <CSFreq>
  • <CSDeploy>
  • <CSPack>
  • <CSDiff>
  • <CSConcat>
  • <Excel2CSPro>
  • <CSExport>
  • <CSIndex>
  • <CSReFmt>
  • <CSSort>
  • <ParadataConcat>
  • <ParadataViewer>
  • <CSCode>
  • <CSDocument>
  • <CSView>
  • <CSWeb>

Pff.setProperty Function

Format
b = pff_name.setProperty(property_name, property_value ‖ string_list);
Description
The Pff.setProperty function modifies the value associated with the Pff's property specified by the string expression property_name. The property will be modified to the value given in the numeric or string expression property_value. If the property_value is blank, the property will be reset to its default value. Alternatively, a string_list can be supplied containing values for properties that have multiple values (such as input data filenames).
Property names can be prefixed with the section name. For example, if you load an existing PFF that has a persistent ID value defined for the item PROVINCE, you can code:
pff_name.setProperty("PROVINCE", 50);
However, if no such property was defined in the PFF, the Pff.setProperty function will not know whether you are modifying a value in the [DataEntryIds] section, the [ExternalFiles] section, or another section. To avoid this ambiguity, when setting new custom properties, you can specify the section name when setting the property:
pff_name.setProperty("DataEntryIds.PROVINCE", 50);
Linking to Embedded Dictionaries
When running a data entry application from a .pen file, such as on an Android device, you may not have access to the dictionary file (.dcf) that may be necessary when running certain programs (such as the Compare Data tool). A special version of Pff.setProperty, when used with the InputDict and OutputDict properties, accepts a dictionary name as an argument. If such an argument is used, certain tools (described in the execpff help) will be launched using the dictionary that is embedded in the .pen file.
pff_name.setProperty("InputDict", LISTING_DICT);
Return Value
The function returns a logical value of 1 (true) because it will always successfully set a property. If the property name is unknown, then the value is assigned to a new parameter (defined in a PFF's [Parameters] section).
Example 1
PROC INTERVIEWER_MENU

   
// run the listing program in the interviewer's assigned cluster
    if INTERVIEWER_MENU = 1 then
       
Pff listing_pff;
        listing_pff.
load("Listing.pff");
        listing_pff.
setProperty("Key", maketext("%v", CLUSTER));
        listing_pff.
exec();
   
endif;
Example 2
PROC REPORT_SELECTION

   
// run the batch application to generate a report on...
    Pff report_pff;
    report_pff.
load("../Report/Report.pff");

   
// ...the data file for the selected province and region
    if REPORT_SELECTION = 1 then
        report_pff.
setProperty("InputData", maketext("../Data/%v%v.csdb", PROVINCE, REGION));

   
// ...the data files for all the regions in the selected province
    elseif REPORT_SELECTION = 2 then
        report_pff.
setProperty("InputData", maketext("../Data/%v*.csdb", PROVINCE));

   
// ...the data files for the entire country
    else
       
List string data_files_listing;
       
dirlist(data_files_listing, "../Data", filter := "*.csdb", recursive := true);
        report_pff.
setProperty("InputData", data_files_listing);

   
endif;

    report_pff.
exec();
See also: Pff Object, Pff.getProperty Function