Client side function error

  • I am trying to add a function to a subreport but continually get the error 'subreport could not be shown'.

    I have pared the function back to be a getworld function to try to get it to go, but no luck.

    The report works fine with the function included but not used or with any other value in the field.

    The function code is:

    <Code>

    Public Function HelloWorld() as String

    Return "Hello world"

    End Function

    </Code>

    The usage is:

    <TableCell>

    <ReportItems>

    <Textbox Name="textbox14">

    <rd:DefaultName>textbox14</rd:DefaultName>

    <Style>

    <FontSize>8pt</FontSize>

    <PaddingLeft>2pt</PaddingLeft>

    <PaddingRight>2pt</PaddingRight>

    <PaddingTop>2pt</PaddingTop>

    <PaddingBottom>2pt</PaddingBottom>

    </Style>

    <CanGrow>true</CanGrow>

    <!--

    <Value>99</Value>

    -->

    <Value>=Code.HelloWorld()</Value>

    </Textbox>

    </ReportItems>

    </TableCell>

    How can I resolve this or at least get more info on the error?

  • Your report has no data source and no dataset and I am sure will get errors displaying. Embedded code uses the data sets in some fashion.

  • Thanks mysorian for your response.

    The xml for this subreport is 625 lines long.

    I could have included the entire definition (incl datasource/dataset/margin/language etc) but I chose to submit only the code relevant to the definition and usage of the function.

    Would it help for you to see the entire definition?

    The report works perfectly when this or any other field references dataset fields or report parameters or hardcoded text.

    But produces an error EVERY time a field references a function.

    The field started off as <Value>=RowNumber(Nothing)</Value> i.e. 1,2,3,4 etc and worked perfectly

    Then I found I had to filter out 0 value records, which omits rows 2 & 3

    But then the formula displays the non-filtered rownumbers i.e. 1, 4 etc

    I want to reference a function that will return a sequential number for the displayed records only ... BUT cannot get ANY function to work!

    Help.

  • We could go off line and you can share the code. But first off all, in the code can't you reference the data set and use some kind of for--each and get rid of the ones you do not want by setting up some criteria?

    mysorian@gmail.com

    I have a Report Builder 3.0 set up and I do not mind helping you if i can.

  • Thanks for your help mysorian

    Finally got it to do what I want i.e. to number the visible rows ONLY

    Code:

    <Code>

    Public Shared _RowNumber As Integer = 1

    Public Function SetRowNumber(thisQty As Integer)

    If thisQty>0 then _RowNumber = _RowNumber+1

    End Function

    </Code>

    There are 3 elements to the usage:

    1: Set tablerow visibility via expression

    <Hidden>=iif(Fields!Qty.Value>0,False,True)</Hidden>

    2: Call function from spare field in output row

    <Value>=Code.SetRowNumber(Fields!Qty.Value)</Value>

    3: Display public variable in appropriate field

    <Value>=Code._ThisInt</Value>

    SSRS appears to process rows left to right and my spare field is right of the display field, so initial value of _RowNumber = 1

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

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