Skip to main content
April 29, 2021
Solved

Logic to print the numbers between two numbers

  • April 29, 2021
  • 11 replies
  • 0 views

Hi,

How can I print the numbers between two numbers.

Eg: Number 1 = 1, Number 2 = 5.

Expected output 2,3,4

Kindly help. Thanks in Advance

Best answer by stefanhelzle0001

Hm ... I'll explain how this works. Then you will be able to adjust things as needed.

enumerate() creates a list of number starting with zero going to n-1. Now you can use Appian internal magic by adding a base offset to this list, meaning the base will be added to each item in the list created by enumerate().

In your case, you will need to modify the offset. Does that help?

11 replies

stefanhelzle0001
April 29, 2021

2 + enumerate(5 - 2)

Not tested but will need to modify the numbers anyway.

April 29, 2021

Thank you Stefan. But here we are planning to declare the two numbers (inputs) as rule input and trying to display the numbers between them. Can you please help any other way you could think.

stefanhelzle0001
April 29, 2021

OK. Then why not just replace the "2" and the "5" by some integer rule inputs?

January 19, 2022

ri!number1 + enumerate((ri!number2-ri!number1)-1)+1,