Hi,
I am using a Execute Stored Procedure smart service and it is returning 2 result set and each result set is returning with multiple values.
Now, when I try to grab the store procedure output result into a variable like below, I am getting an error.
An error occurred while evaluating expression: keys:AC!ResultSets[0] (Invalid index (0) for list: valid range is 1..2) (Data Outputs)
Discussion posts and replies are publicly visible
The first item in an Appian list or array is at index 1, not zero.
I tried with index 1, error gone, but no luck with the values.
Below are the screen shots of my stored procedure output along with Appian PM. I am unable to capture these array of values. Anything wrong in my settings.
Can you store ac!ResultSets in a pv! and show us the value of that pv! in a new instance?
I suggest to call that SP in an interface and store the result to a local variable. This is super fast to debug and understand the returned data.
Unknown said:I suggest to call that SP in an interface
I'd go one step further and suggest wrapping it in an expression rule. Once that rule is up and running (and this is very easy to test as needed), you can use it anywhere easily - interface, process model, etc.
If I test using expression rule inside Expression Rule, I found that result/ (o/p) is of type Map. Not sure if I have convert this to any other type before saving to pv variable for further use.
You were trying to store this result in a pv! of Integer array type.
Change the type of pv! to Map and keep it multiple.
Depending on your use case, you could either output to a "Map" type PV as already suggested, or alternatively, specify a property of the expression rule output in order to make the expression rule actually return something closer to your list of integer (which might be more useful if the only thing that'll ever be relevant about the procuedure's output is the list of IDs it outputs).
When I am trying to convert from list of map to list of integers, I am getting an error. Is it possible to convert from map to integers
Expression evaluation error at function 'tointeger' [line 12]: Could not cast from Map to Number (Integer). Details: CastInvalidCould not cast from Map to Number (Integer). Details: CastInvalid
Why you are trying to cast the output? you can just index the property you want from results.
And how is it even possible to cast a Map into Number?
swapnar6405 said:When I am trying to convert from list of map to list of integers, I am getting an error.
You wouldn't simply use "tointeger()" for this. But if you want specific advice you'll need to show us what you're actually currently trying to do in the rule output.