Skip to main content
Question

How do you print the number between 1300 and 1600 in Appian?

A
Anonymous
December 30, 2025

Answer

Solution 1:

This expression builds a list of the integers from 1301 to 1599 using a!localVariables(), enumerate(), and a!forEach().


Appian Code:

a!localVariables(
local!initialValue: 1300,
local!finalValue: 1600,
a!forEach(
items: enumerate(
local!finalValue - (local!initialValue + 1)
) + 1,
expression: local!initialValue + fv!item
)
)


Explanation :

1. Initializing the local variables

local!initialValue: 1300,
local!finalValue: 1600,

local!initialValue holds the starting value, 1300, and local!finalValue holds the ending value, 1600. To change the range, you edit these two lines and leave the rest of the expression alone.


2. How many items

enumerate(
local!finalValue - (local!initialValue + 1)
)

The subtraction works out to 1600 - (1300 + 1) = 299, so this becomes enumerate(299). enumerate() returns the integers starting at 0, so here it returns 0 up to 298.

Result: {0, 1, 2, ..., 298}


3. Shifting the values

items: enumerate(299) + 1

Adding 1 to every item moves the list from 0 to 298 up to 1 to 299, and a!forEach() uses that list as its items.

Result: {1, 2, 3, ..., 299}


4. Looping over the items

a!forEach(
items: enumerate(299) + 1,
expression: local!initialValue + fv!item
)


a!forEach() goes through the list one item at a time. fv!item is the current item, and each pass adds it to 1300:

fv!item

Calculation

Result

1

1300 + 1

1301

2

1300 + 2

1302

3

1300 + 3

1303

...

...

...

299

1300 + 299

1599

Final output

The expression returns 299 integers, from 1301 to 1599:

{1301, 1302, 1303, 1304, ..., 1598, 1599}


Both 1300 and 1600 are left out. To include 1600, change the items line to:

items: enumerate(local!finalValue - local!initialValue) + 1

That gives 1301 through 1600, which is 300 integers.


Remaining patterns: none after a second pass. I also checked the numbers: 1600 - 1301 = 299, and the 1600 variation gives enumerate(300) + 1, so 300 integers.


Solution 2: enumerate() without a!forEach()

This version uses enumerate() and arithmetic to build the list of consecutive integers directly, with no loop.


Appian Code:

a!localVariables(
local!startInt: 1300,
local!endInt: 1600,
enumerate((local!endInt - local!startInt) - 1)
+ local!startInt + 1
)


1. Initializing the local variables

local!startInt: 1300,
local!endInt: 1600,

local!startInt holds the starting value, 1300, and local!endInt holds the ending value, 1600. Change these two lines and the same expression works for any range.


2. How many items enumerate should process

enumerate((local!endInt - local!startInt) - 1)

The subtraction works out to (1600 - 1300) - 1 = 299, so this becomes enumerate(299). That returns the integers 0 to 298.

Result: {0, 1, 2, ..., 298}


3. Shifting the range

enumerate((local!endInt - local!startInt) - 1)
+ local!startInt + 1

Adding 1300 and 1 to every enumerated value moves the list so it starts at 1301:

Enumerated value

Calculation

Result

0

0 + 1300 + 1

1301

1

1 + 1300 + 1

1302

2

2 + 1300 + 1

1303

...

...

...

298

298 + 1300 + 1

1599


4. Final output

The expression returns 299 integers, from 1301 to 1599. Both boundary values, 1300 and 1600, are left out.

{1301, 1302, 1303, ..., 1598, 1599}


Why use this version

It’s shorter than the a!forEach() solution, because the range comes straight from enumerate() and one addition. Both versions build a list of n items, so both take O(n) time. Dropping a!forEach() doesn’t make the work constant.


Use it when you only need a run of consecutive integers. If each item needs its own expression, a!forEach() is the better fit.

Try it yourself

Change the inputs or the expression and run it to see what it returns.

ri!startNumber=
ri!endNumber=

Independent evaluator: it approximates the Appian expression language and may differ from a real Appian environment. Verify anything that matters. Terms

JuniorExpressions#coding#sailcoding