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
Discussion posts and replies are publicly visible
2 + enumerate(5 - 2)
Not tested but will need to modify the numbers anyway.
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.
OK. Then why not just replace the "2" and the "5" by some integer rule inputs?
Hi Stephan,
yes. i have tried as below. When i give number1 as "1" and number2 as "5", I am getting below output.
Here we should not print 1 here and only print 2 3 4. Can you please help here.
Exp Rule: ri!number1 + enumerate(ri!number2-ri!number1)
Output:
1
2
3
4
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?
OK. thanks. this helps.
a!localVariables( local!no1: 5, local!no2: 10, joinarray(a!forEach( items: enumerate(local!no2-local!no1-1), expression: local!no1+fv!index )," ") )
Yes - the conversation is ~ a year old, but here is another version:ldrop(enumerate(ri!number2),1+ri!number1),
It's helpful