How do you collect data from a list of string that is a property of a method parameter using a Method Invocation Data Collectior? We either end up with [CANNOT EVALUATE: Error getting data from specified method parameter] or [System.Collections.Generic.List`1[System.String]].
Any help is appreciated.
Looking at the documentation on List<String> there isn't a single method you can call (without adding new methods to your code) that would display all the elements. You could certainly get the first element, last element, or any element by index, but if you want all elements in a variable-length list you can't do it in a single call with no custom methods added.
If you were willing to add code, you could call ForEach(Action<T> action) where action was a method that takes a String and prints it via Console.WriteLine(). The ForEach method passes each element of a list in turn to the Action method. The result would be a newline-separated list of all the elements.
This is not ideal, but seems like the only way to get exactly what you want.
Thinking about this, should I assume that you mean a java.util.List List<String> ?
That is more interesting!
What have you tried so far? I assume that you have tried the obvious 'Use toString()'?
If you had a method that would return the info that you wanted, then the 'Use Getter Chain' could possibly do what you want. Granted, this is a big 'if'.
We did try using a Linq statement with the "use getter chain option" but that returned an error (as we expected it likely would).
RBaco is spot on. If you were OK with just the first element of the string array, then somithing as simple as using a getter chain with "[0]" should do the trick. If that does not work as expect, see if there is an error in the agent log, and let us know what the error is.
We were hoping to capture all the elements, but it appears this will require the addition of a new method to include in the getter chain. We have control over the source code in this case, so it's something we can do although a bit inconvenient.
Thanks!
Looking at the documentation on List<String> there isn't a single method you can call (without adding new methods to your code) that would display all the elements. You could certainly get the first element, last element, or any element by index, but if you want all elements in a variable-length list you can't do it in a single call with no custom methods added.
If you were willing to add code, you could call ForEach(Action<T> action) where action was a method that takes a String and prints it via Console.WriteLine(). The ForEach method passes each element of a list in turn to the Action method. The result would be a newline-separated list of all the elements.
This is not ideal, but seems like the only way to get exactly what you want.
Hi,
It is a .NET object of List<string>. Calling ToString() returns "[System.Collections.Generic.List`1[System.Strin
Thanks!
When you say "list of string data", do you mean that you have a string array? If so, are you wanting a specific element of that array, (say always the first element) or everything in the array?