• <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
      • SystemApp Object
      • ValueSet Object
      • Program Control Statements
      • Assignment Statements
      • Data Entry Statements and Functions
      • Batch Edit Statements
      • Numeric Functions
      • String Functions
        • compare Function
        • compareNoCase Function
        • Concat Function
        • String Concatenation Operator
        • Edit Function
        • GetBuffer Function
        • Length Function
        • maketext Function
        • Message Formatting Options
        • Pos Function
        • PosChar Function
        • RegExMatch Function
        • Replace Function
        • StartsWith Function
        • Strip Function
        • ToLower Function
        • ToNumber Function
        • ToUpper Function
      • 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>

maketext Function

Format 1
s = maketext(string_expʃ, argument1, ..., argumentNʅ);
Format 2
s = maketext(msg_numʃ, argument1, ..., argumentNʅ);
Description
The maketext function formats a text string with inserted values. Each argument is sequentially inserted into the text string. Arguments can be numeric or string expressions, but the type of the argument must match the type of the receiving field in the string expression.
In the string expression:
    %[n]d = Insert a number and display it as an integer
    %[n.d]f = Insert a number and display it as a decimal value
    %[n.d]s = Insert a text string
where "n" is the size of the field and "d" is the number of decimal places to show for a number. For a complete list of possible message formatters, see Message Formatting Options.
Numbers are never truncated. Text strings are truncated only if ".d" is used. If "n" is positive, the insert is right-justified in the size of the field. If "n" is negative, the insert is left-justified in the size of the field. If "n" is a positive number with a leading zero, the insert is right-justified in the size of the field and zero-filled to the left. When inserting a number, if "n" is preceded by a "+", the sign of the number is always displayed.
If you wish to split message text across two or more lines, refer to the Message Formatting Options page.
Return Value
The function returns the formatted string.
Example 1
TEXT = maketext("Sex= %d", SEX);
Example 2
numeric integerValue = 23456;

errmsg( "%d"       , integerValue);      //  23456
errmsg( "%-10d"    , integerValue);      //  23456
errmsg( "%10d"     , integerValue);      //       23456
errmsg( "%+10d"    , integerValue);      //      +23456
errmsg( "%+010d"   , integerValue);      //  +000023456
errmsg( "%-010d"   , integerValue);      //  0000023456
errmsg( "%f"       , integerValue);      //  23456.000000  Note the usage of %f


numeric decimalValue = 12.567;

errmsg( "%f"        , decimalValue);    //   12.567000
errmsg( "%-10.3f"   , decimalValue);    //   12.567
errmsg( "%d"        , decimalValue);    //   12           Note the usage of %d
errmsg( "%10.2f"    , decimalValue);    //        12.57
errmsg( "%10.3f"    , decimalValue);    //       12.567
errmsg( "%+10.3f"   , decimalValue);    //      +12.567
errmsg( "%+010.3f"  , decimalValue);    //   +00012.567
errmsg( "%010.3f"   , decimalValue);    //   000012.567
errmsg( "%10.5f"    , decimalValue);    //     12.56700


string stringValue = "abcdef";

errmsg( "%s"        , stringValue);     //   abcdef
errmsg( "%-10s"     , stringValue);     //   abcdef
errmsg( "%-10.3s"   , stringValue);     //   abc
errmsg( "%10s"      , stringValue);     //       abcdef
errmsg( "%10.3s"    , stringValue);     //          abc
See also: Message Formatting Options, Message File (.mgf), Message.formatText Action, Edit Function