View "Dim" Variable Values

View "Dim" Variable Values

Joseph.Lasser
Participant Participant
789 Views
5 Replies
Message 1 of 6

View "Dim" Variable Values

Joseph.Lasser
Participant
Participant

This is likely a poor question, but is there a a way to view a list of all declared variables in a rule and their associated values?  For example, please reference the script below:

Dim Test1 = 1
Dim Test2 = 2
Dim Test3 = 3
Dim Sum = Test1+Test2+Test3

Within the rule editor, would there be a way to see that the variable Sum is equal to 6? 

0 Likes
Accepted solutions (1)
790 Views
5 Replies
Replies (5)
Message 2 of 6

cidhelp
Collaborator
Collaborator
Accepted solution

Hello @Joseph.Lasser ,

 

you can log the value using logger:

cidhelp_0-1740153262366.png

 

0 Likes
Message 3 of 6

Joseph.Lasser
Participant
Participant

Excellent, thank you!

0 Likes
Message 4 of 6

layochim
Enthusiast
Enthusiast

@Joseph.Lasser i came across this post in my searches.  I have a similar case but i'd like to SUM all the variables without having to do "Test 1 + Test2...etc"  Is there a way of doing this in iLogic?

0 Likes
Message 5 of 6

WCrihfield
Mentor
Mentor

If you are talking about a built-in Function, like in Excel, then I do not recall one like that at the moment, but the 'List(Of t)' object has a method like that, when the Type (t) is a numeric type, such as Integer or Double.  For example:

Dim Val1 As Double = 1.5
Dim Val2 As Double = 3
Dim Val3 As Double = 5.5
Dim values As New List(Of Double) From {Val1, Val2, Val3 }
Dim sum As Double = values.Sum
Logger.Info("Sum = " & sum.ToString())

This essentially adds all the Double type values into a new 'List of Double', then since the Type of its entries is Double, its 'Sum' extension method (a Function) is enabled, which returns the Sum of all its entries. 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 6 of 6

layochim
Enthusiast
Enthusiast

This is exactly what i was looking for, Thank you!

0 Likes