Acces and change an Arraylist or String in multiple functions, within the same iLogic rule

Acces and change an Arraylist or String in multiple functions, within the same iLogic rule

jaco011
Advocate Advocate
811 Views
2 Replies
Message 1 of 3

Acces and change an Arraylist or String in multiple functions, within the same iLogic rule

jaco011
Advocate
Advocate

Hi all,

 

I have an iLogic rule, which basically contains the following;

Sub Main
 'Do some checks and determine some values based on the document
 Sub_1(.....)
End Main

Sub_1(.....)
 While
  Result_1 = Function_1(....)
  Result_2 = Function_2(Result_1)
  Total_Result = Total_Result + Result_2
 End While
'Write Total result as txt file
End Sub

Function_1(....)
 For each occurence
  If occurence = phantom
   'Repeat function 1 for sub occurences
  Else If
   List_1.add(...)
  Else
   List_2.add(...)
  End if
 Next

Sort lists and write to string, with ; between the values
Sub_2(...)

Result Function_1 = String
End Function

Function_2(...)
 Split string based on the ;
 Write back to arrays
 Sort array lists
 Write to custom table
 Result Function_2 = string
End Function


I want the Arraylist be available (adding / get values) in multiple functions / subs, because now I have to write it to a string and split that string again in another sub. Is this possible? Also because I want to loop through the function and start it within each own, and I want all these results add in the same ArrayList.

I learned ilogic by meself using this forum and some basic coding knowledge, but I can't find an solution for this.

Is there someone who knows how to do this? (I would also be happy with an string which can be changed everywhere, than i stick to the splitting.)

0 Likes
Accepted solutions (1)
812 Views
2 Replies
Replies (2)
Message 2 of 3

A.Acheson
Mentor
Mentor
Accepted solution

One method is leave the declaration outside the sub routines. This allows access to all sub routines. I am not sure what this method is called.

 

Sub Main

List_1.add("1")

Call example()

'....Read arraylist

End Sub

 

Dim List_1 As New Arraylist

 

Sub example()

List_1.add("2")

End Sub

 

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
Message 3 of 3

jaco011
Advocate
Advocate

Didn't know such thing was allowed! This is fantastic! Thank you

0 Likes