Skip to main content
Known Participant
Apr 29, 2021 10:25 AM UTC
Solved

Logic to print the numbers between two numbers

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

stefanhelzle0001
Brainy
Apr 29, 2021 11:52 AM UTC

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
Brainy
Apr 29, 2021 11:33 AM UTC

2 + enumerate(5 - 2)

Not tested but will need to modify the numbers anyway.

Known Participant
Apr 29, 2021 11:39 AM UTC

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
Brainy
Apr 29, 2021 11:40 AM UTC

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

Participating Frequently
Jan 19, 2022 12:35 PM UTC

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