Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Pass integer array to Code function Expand / Collapse
Author
Message
Posted Friday, March 4, 2011 7:25 AM


SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: 2 days ago @ 3:16 PM
Points: 292, Visits: 787
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
Post #1073311
Posted Friday, March 4, 2011 7:45 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Tuesday, November 4, 2014 12:48 PM
Points: 2,818, Visits: 2,566
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)

Post #1073330
Posted Friday, March 4, 2011 7:52 AM


SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: 2 days ago @ 3:16 PM
Points: 292, Visits: 787
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)
Post #1073342
Posted Friday, March 4, 2011 8:01 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Tuesday, November 4, 2014 12:48 PM
Points: 2,818, Visits: 2,566
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.
Post #1073352
Posted Friday, March 4, 2011 8:25 AM


SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: 2 days ago @ 3:16 PM
Points: 292, Visits: 787
Okay, thanks anyway, Daniel.
Post #1073366
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse