SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Pass integer array to Code function


Pass integer array to Code function

Author
Message
Simon E Doubt
Simon E Doubt
Mr or Mrs. 500
Mr or Mrs. 500 (591 reputation)Mr or Mrs. 500 (591 reputation)Mr or Mrs. 500 (591 reputation)Mr or Mrs. 500 (591 reputation)Mr or Mrs. 500 (591 reputation)Mr or Mrs. 500 (591 reputation)Mr or Mrs. 500 (591 reputation)Mr or Mrs. 500 (591 reputation)

Group: General Forum Members
Points: 591 Visits: 892
Hello All,

I have a report with the following elements:

- A mutli-valued parameter (@paramBoxSizes), whose data type is Integer
- A VB function implemented in the 'Code' section called GetBoxSizeGroup that wants an integer array as one of its input parameters
- A tablix with some groups

In one of the Group Expressions in my tablix, I would like enter an expression that passes my mutli-valued parameter values as an array of integers to my VB function.

Unfortunately, I've only been able to find the SPLIT function, which will pass a string array, not an integer array.

=Code.GetBoxSizeGroup(Split(Parameters!paramBoxSizes.Value,","))


I was hoping to avoid having to convert the array inside my VB function from a string array to an integer array. Does anyone have any suggestions?

Many thanks,
-Simon
Daniel Bowlin
Daniel Bowlin
SSCarpal Tunnel
SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)

Group: General Forum Members
Points: 4152 Visits: 2629
I think all you want is
Parameters!paramBoxSizes.Value


If you were looking for a single value you would use something like:
Parameters!paramBoxSizes.Value(0)


Simon E Doubt
Simon E Doubt
Mr or Mrs. 500
Mr or Mrs. 500 (591 reputation)Mr or Mrs. 500 (591 reputation)Mr or Mrs. 500 (591 reputation)Mr or Mrs. 500 (591 reputation)Mr or Mrs. 500 (591 reputation)Mr or Mrs. 500 (591 reputation)Mr or Mrs. 500 (591 reputation)Mr or Mrs. 500 (591 reputation)

Group: General Forum Members
Points: 591 Visits: 892
Thanks very much for the suggestion, Daniel.

Unfortunately, it fails with the following error:

The GroupExpression expression for the tablix ‘Tablix2’ contains an error:
Unable to cast object of type 'System.Object[]' to type 'System.Int32[]'.
(rsRuntimeErrorInExpression)

Daniel Bowlin
Daniel Bowlin
SSCarpal Tunnel
SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)

Group: General Forum Members
Points: 4152 Visits: 2629
If I understand the error you are passing an object rather than an integer array. Unless you can deal with that in your code by taking the object apart and converting it to an integer array, I don't have any additional suggestions.

Good luck.
Simon E Doubt
Simon E Doubt
Mr or Mrs. 500
Mr or Mrs. 500 (591 reputation)Mr or Mrs. 500 (591 reputation)Mr or Mrs. 500 (591 reputation)Mr or Mrs. 500 (591 reputation)Mr or Mrs. 500 (591 reputation)Mr or Mrs. 500 (591 reputation)Mr or Mrs. 500 (591 reputation)Mr or Mrs. 500 (591 reputation)

Group: General Forum Members
Points: 591 Visits: 892
Okay, thanks anyway, Daniel.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search