Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Use a Comparison to Create a Textual Result

Example: Indicate "Low", "Medium", and "High" Student-Teacher Ratios

Use a variable to record the student-teacher ratio. Then set variables to mark the points at which the ratio is considered medium or high. Finally, use two if (cond, trueValue, falseValue) blocks to return the "Low", "Medium" or "High" text based on the ratio value.

Code Block

stRatio = [Distinct Count: Student ID] / [Distinct Count: Teacher ID];
mediumThreshold = 20;
highThreshold = 40;

if (stRatio < mediumThreshold,
    "Low",
    if (stRatio >= highThreshold,
        "High",
        "Medium"
    )
)