• <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
    • Templated Reporting System
    • HTML and JavaScript Integration
    • Action Invoker
      • Overview
      • Execution Environments
      • Security and Formatting Options
      • Base Actions
      • Application Namespace
        • Application Action Invoker Namespace
        • Application.getFormFile Action
        • Application.getQuestionnaireContent Action
        • Application.getQuestionText Action
      • Clipboard Namespace
      • Data Namespace
      • Dictionary Namespace
      • File Namespace
      • Hash Namespace
      • Localhost Namespace
      • Logic Namespace
      • Message Namespace
      • Path Namespace
      • Settings Namespace
      • Sqlite Namespace
      • System Namespace
      • UI Namespace
    • Appendix
  • <CSEntry>
  • <CSBatch>
  • <CSTab>
  • <DataViewer>
  • <TextView>
  • <TblView>
  • <CSFreq>
  • <CSDeploy>
  • <CSPack>
  • <CSDiff>
  • <CSConcat>
  • <Excel2CSPro>
  • <CSExport>
  • <CSIndex>
  • <CSReFmt>
  • <CSSort>
  • <ParadataConcat>
  • <ParadataViewer>
  • <CSCode>
  • <CSDocument>
  • <CSView>
  • <CSWeb>

Application.getFormFile Action

Format
s = CS.Application.getFormFile(ʃname := ... ‖ path := ...ʅ)
ArgumentDescriptionTypes / Required
nameThe name of a form file associated with an application.string
not required
pathThe path of a form file to read.string
not required
Description
The Application.getFormFile action returns a form file associated with an application or loaded from the disk. One, and only one, of the arguments name or path must be provided.
If specifying name, you can also specify the name of an application or dictionary. When using an application name, the application's main form file is returned. When using a dictionary name, the form file associated with that dictionary is returned.
If neither name nor path are specified, the application's main form file is returned.
Return Value
The action returns the form file.
Exceptions
The action throws an exception if any of its arguments are not specified in a valid form, or if:
  • No form file, or associated form file, exists with the specified name.
  • The name identifies a dictionary that does not have an associated form file.
  • The form file does not exist or cannot be read.
Example (JavaScript)
// write to the console all of the field names and their capture types
const formFile = CS.Application.getFormFile({
    path: 
"Census Data Entry.fmf"
});

function iterateOverItems(entity) {
   
if( entity.items === undefined ) {
       
return;
    }

    entity.items.forEach(item => {
       
if( item.type === "field" ) {
            console.log(`${item.name}: ${item.capture.type}`);
        }
       
else {
            iterateOverItems(item);
        }
    });
}

formFile.levels.forEach(level => {
    iterateOverItems(level);
});
Example (CSPro Logic)
// construct the input needed for the questionnaire view, using the external dictionary
// attached to this application but getting the forms and question text from the disk
string questionnaireViewInput =
   
maketext("{ \"dictionary\": %s, \"forms\": %s, \"questionText\": %s, \"case\": %s }",
             
CS.Dictionary.getDictionary(name := "MARINE_DICT"),
             
CS.Application.getFormFile(path := "Marine Mammals Survey.fmf"),
             
CS.Application.getQuestionText(path := "Marine Mammals Survey.ent.qsf"),
             
CS.Data.getCase(name := "MARINE_DICT"));

// pass this input to the questionnaire view
CS.UI.view(path := Path.concat(html, "questionnaire-view", "index.html"),
           
inputData := @object questionnaireViewInput);
See also: Application Action Invoker Namespace, Application.getQuestionnaireContent Action