Generate a Numeric Triangle Pattern
Easy
Given an integer n, write an Appian expression that generates a numeric triangle pattern with n rows. Each row should contain consecutive numbers starting from 1 up to the row number.
Example
Input:
ri!n = 5
Output:
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
ri! Rule Inputs
ri!nNumber (Integer)0
Example 1 — Case 1
Input: ri!n
5
Output:
{
"1",
"1 2",
"1 2 3",
"1 2 3 4",
"1 2 3 4 5"
}Example 2 — Case 2
Input: ri!n
8
Output:
{
"1",
"1 2",
"1 2 3",
"1 2 3 4",
"1 2 3 4 5",
"1 2 3 4 5 6",
"1 2 3 4 5 6 7",
"1 2 3 4 5 6 7 8"
}Example 3 — Case 3
Input: ri!n
2
Output:
{
"1",
"1 2"
}Appian Expression Tips
- • Use
ri!variableNamefor rule inputs - • Use
a!localVariables(local!x: …, body)for locals - • Use
a!forEach(items: …, expression: fv!item)to iterate - • Use
where()/reject(fn!isnull, list)to filter