Pass integer array to Code function

  • 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

  • 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)

  • 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)

  • 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.

  • Okay, thanks anyway, Daniel.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply