Does Appian (7.11 on-premise) have any easy way in an expression/SAIL to perform

Does Appian (7.11 on-premise) have any easy way in an expression/SAIL to perform the common looping type logic most languages have? Specifically I would like to be able to perform for-next/while/do-until type loops on some other functions and data.
Examples in other languages:
VB: For indexB = 20 To 1 Step -3
C/java: for (i = 0; i < 10; i++)
Fortran: DO I = I_START, I_END, I_INC
A(I) = x+y, etc.
END DO
Basic: FOR cntr = 1 TO 100
total = total + 10
NEXT cntr

I looked through the forums a bit as well as the plugins/expression library and the documentation and I can't find any way to do looping of this type other than via a process model or the somewhat constraining apply(), all(), etc. type functions.

Today I had a need to create a list/array of integers representing years (2012,2013,2014,2015,2016,2017). In most languages I would concatenate values for (myyear = 2012; myyear <= 2017;...

OriginalPostID-188844

OriginalPostID-188844

  Discussion posts and replies are publicly visible

Parents
  • Josh, thanks for the suggestion on the change on the cast() function, I'll take a look at it. As for your year() reference, yes, I was having to do something like that. A coworker had made a Java based plugin to calculate company holidays using some preexisting logic another department had built. A second coworker had built a rule in Appian that would take an individual year and spit out the holidays for a few years before & after that years. It used concatenation inside of the rule and I wanted to see if I could rewrite it to allow you to pass in 2 integers for the number of years before & after the current and get the same results. (I didn't test with 0 as you did, thanks). Here is what my replacement looked like, white convoluted:

    apply(fn!commerceobservedholidaysforagivenyear,
    apply(fn!cast(typeof(123),_),{union(reverse(apply(fn!sum(year(local(now())),_),-1*enumerate(ri!YearsBeforeCurrent+1))),
    apply(fn!sum(year(local(now())),_),enumerate(ri!YearsAfterCurrent+1)))}) )

    returned value: 1/1/2014; 1/20/2014; 2/17/2014; 5/26/2014; 7/4/2014; 9/1/2014; 10/13/2014; 11/11/2014; 11/27/2014; 12/25/2014; 1/1/2015; 1/19/2015; 2/16/2015; 5/25/2015; 7/4/2015; 9/7/2015; 10/12/2015; 11/11/2015; 11/26/2015; 12/25/2015; 1/1/2016; 1/18/2016; 2/15/2016; 5/30/2016; 7/4/2016; 9/5/2016; 10/10/2016; 11/11/2016; 11/24/2016; 12/26/2016; 1/2/2017; 1/16/2017; 2/20/2017; 5/29/2017; 7/4/2017; 9/4/2017; 10/9/2017; 11/11/2017; 11/23/2017; 12/25/2017
Reply
  • Josh, thanks for the suggestion on the change on the cast() function, I'll take a look at it. As for your year() reference, yes, I was having to do something like that. A coworker had made a Java based plugin to calculate company holidays using some preexisting logic another department had built. A second coworker had built a rule in Appian that would take an individual year and spit out the holidays for a few years before & after that years. It used concatenation inside of the rule and I wanted to see if I could rewrite it to allow you to pass in 2 integers for the number of years before & after the current and get the same results. (I didn't test with 0 as you did, thanks). Here is what my replacement looked like, white convoluted:

    apply(fn!commerceobservedholidaysforagivenyear,
    apply(fn!cast(typeof(123),_),{union(reverse(apply(fn!sum(year(local(now())),_),-1*enumerate(ri!YearsBeforeCurrent+1))),
    apply(fn!sum(year(local(now())),_),enumerate(ri!YearsAfterCurrent+1)))}) )

    returned value: 1/1/2014; 1/20/2014; 2/17/2014; 5/26/2014; 7/4/2014; 9/1/2014; 10/13/2014; 11/11/2014; 11/27/2014; 12/25/2014; 1/1/2015; 1/19/2015; 2/16/2015; 5/25/2015; 7/4/2015; 9/7/2015; 10/12/2015; 11/11/2015; 11/26/2015; 12/25/2015; 1/1/2016; 1/18/2016; 2/15/2016; 5/30/2016; 7/4/2016; 9/5/2016; 10/10/2016; 11/11/2016; 11/24/2016; 12/26/2016; 1/2/2017; 1/16/2017; 2/20/2017; 5/29/2017; 7/4/2017; 9/4/2017; 10/9/2017; 11/11/2017; 11/23/2017; 12/25/2017
Children
No Data