How to use "Generic List" functions in iLogic rule
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I've been using VB "generic lists" very successfully for working with dynamic lists in my iLogic rules. The built-in functions like "Sort", "Contains", "Count", etc. are very handy. However, there are a couple of functions I really want to use, but I can't figure out how. Namely, the "Count(Of ...)" and "RemoveAll" functions.
See the script below for an example of how I'd like to use these functions:
Dim oStringList As New List(Of String) oStringList.Add("Dog") oStringList.Add("Cat") oStringList.Add("Dog") oStringList.Add("Fish") oStringList.Add("Dog") oStringList.Add("Fish") oDogCount = oStringList.Count(Of "Dog") 'Should equal 3 oStringList.RemoveAll("Dog") 'List should then contain Cat, Fish, and Fish
I can't find any documentation whatsoever on the "Count(Of ...)" function, or any other built-in function for counting the occurrences of a specific item in my list.
There's a very nice example in the .NET documentation (here) demonstrating how to use "RemoveAll", but I can't figure out how to implement what they've done into my iLogic code.
Of course I can accomplish these things with for loops, but it'd be great if I could take advantage of the built-in functions like I can for "Sort", "Contains", "Count", etc.
Any advice on how to use these in an iLogic rule would be greatly appreciated.