Skip to content

Output the Log

Overview

When you enable "Output the log" on the Formula tab of the Manage Table screen, you can check a log in JSON format in the console.

When a formula does not work as intended, the log output can be useful.

Log Output of "Formula: Default"

Table settings

Let us look at the log output when "Calculation method: Default" is used to calculate "Gross profit = Sales - Total purchases".

  1. Create a new table and add the following columns.

    Column Column Name Name Displayed Role
    Numeric Value A NumA Gross profit Holds the result of the calculation
    Numeric Value B NumB Sales Enter the amount of sales
    Numeric Value C NumC Total purchases Enter the total amount of purchases
  2. Open the Formula tab of the Manage Table screen and set the formula as follows.

    Calculation Method Target Formula
    Default Gross profit Sales - Total purchases
  3. Enable "Output the log".

  4. Click the "Update" button in the command button area.
  5. Open the "Developer Tools" of the web browser and open the "Console".
  6. Open the create new record screen, enter the following values in "Sales" and "Total purchases", and click the "Create" button.

    Sales Total purchases
    1000000 500000
  7. When you click the "Update" button in the command button area, a log like the following is output to the "Console".

Checking the log

You can see that three JSON objects are output. The log below is formatted for readability.

formulaSet: {
    "CalculationMethod": "Default",
    "Target": "NumA",
    "Formula": {
        "OperatorType": 0,
        "Children":[
            {"ColumnName": "NumB", "OperatorType": 0},
            {"ColumnName": "NumC", "OperatorType": 2}
        ]
    },
    "Id":1
}
formulaSource: {
    "NumA": 500000.0000,
    "NumB": 1000000.0000,
    "NumC": 500000.0000
}
formulaResult: {
    "NumA": 500000
}

How to read the log

The details of the three objects are as follows.

JSON Object Meaning
formulaSet The settings of the formula
formulaSource The value of each column that the formula targets
formulaResult The result of running the formula

The details of the formulaSet object are as follows.

Value of the formulaSet Object Meaning
CalculationMethod The calculation method (Default: Default, Script: Extended)
Target The column set as the target
Formula The formula
OperatorType The operator (0: none, 1: addition, 2: subtraction, 3: multiplication, 4: division)
Children The content of the calculation
ColumnName The column name
Id The ID of the formula

Log Output of "Formula: Extended"

Let us look at the log output when the year, the month and the day are entered separately into three numeric columns and combined into one date column.

Table settings

  1. Create a new table and add the following columns.

    Column Column Name Name Displayed Role
    Numeric Value A NumA Year Enter a number that represents the year
    Numeric Value B NumB Month Enter a number that represents the month
    Numeric Value C NumC Day Enter a number that represents the day
    Date A DateA Date Holds the result of the calculation
  2. Open the Formula tab of the Manage Table screen and set the formula as follows.

    Calculation Method Target Formula
    Extended Date $DATE(Year,Month,Day)
  3. Enable "Output the log".

  4. Click the "Update" button in the command button area.
  5. Open the "Developer Tools" of the web browser and open the "Console".
  6. Open the create new record screen, enter the following values in "Year", "Month" and "Day", and click the "Create" button.

    Year Month Day
    2017 3 1
  7. When you click the "Update" button in the command button area, a log like the following is output to the "Console".

Checking the log

You can see that three JSON objects are output. The log below is formatted for readability.

formulaSet: {
    "CalculationMethod": "Extended",
    "Target": "DateA",
    "FormulaScript": "$DATE(Year,Month,Day)",
    "FormulaMapping": "{\"NumA\":\"Year\",\"NumB\":\"Month\",\"NumC\":\"Day\"}",
    "Id": 1
}
formulaSource: {
    "ResultId": 5199,
         : omitted
    "NumHash": {
        "NumA": {
            "Value": 2017.0000
        },
        "NumB": {
            "Value": 3.0000
        },
        "NumC": {
            "Value": 1.0000
        }
    },
        : omitted
    "DateHash": {
        "DateA": "2017-03-01T00:00:00"
    },
        : omitted
}
formulaResult: {
    "DateA": 2017/03/01
}

How to read the log

The details of the three objects are as follows.

JSON Object Meaning
formulaSet The settings of the formula
formulaSource The value of each column that the formula targets
formulaResult The result of running the formula

The details of the formulaSet object are as follows.

Value of the formulaSet Object Meaning
CalculationMethod The calculation method (Default: Default, Script: Extended)
Target The target column
FormulaScript The internal representation of the formula
FormulaMapping The correspondence table between the names displayed and the column names
Id The ID of the formula