Column Properties

Column properties are strings that are attached to a column in a Build or cPlan, which can be used by other parts of the application. For instance, the Label property defines the text that is displayed in column headers (so that a column's name does not have to be the same as its label), and the Format property defines the number, date, or period format used to display values to the user.

These properties can be defined on a column in a Build script like this:

build {
  text-input "data.txt" { 
    column "s.goal" type="string" {
      property "Label" "Shipments Goal"
    } 
    column "Order Date" type="date" { 
      property "Format" "MMM DD, YYYY" 
    }
...

Or in a cPlan like this:

cplan {
  input "data.cbase" 
  calc "Profit" `value("Revenue") - value("Cost")` {
    property "Format" "$#,#.00" 
  } 
...

A more compact coding is also possible. The Label and Format properties can be defined using attributes like this:

build {
  text-input "data.txt" {
    column "s.goal" type="string" label="Shipments Goal" 
    column "Order Date" type="date" format="MMM DD, YYYY" 
...

Or this:

cplan {
  input "data.cbase" 
  calc "Profit" `value("Revenue") - value("Cost")` format="$#,#.00" 
...

Note that the format attribute in a Build script serves two purposes for date and period columns. It sets the format used for parsing the text input, and it also sets the Format property on the column, determining how the date/period is displayed later. If you want those two things to be different, you could specify:

  column "Order Date" type="date" format="MM/DD/YYYY" {
    property "Format" "MMM DD, YYYY" 
  }

The input format would then be "MM/DD/YYYY" and the output format would be "MMM DD, YYYY". The more compact definition of the column overrides the input column with the input-format attribute, like this:

column "Order Date" type="date" input-format="MM/DD/YYYY" format="MMM DD, YYYY"

See also: