none
Remove underscore from Field names RRS feed

  • Question

  • I use reportviewer to render local reports in my web application using a Table control in report designer. I have parameters in the report that I set from the code. The problem is that some of the field names that I sent thru my code (using parameters) have a space in between.

     

    This is the expression I use to set the header value of each column in the table (1st column):

    =Parameters!param1.Value

     

    And this is the expression I use to fill Details area of the table (1st column):

    =Fields(Parameters!param1.Value).Value

     

    Notice that both use param1. Now if don't use an underscore (_) instead of a space in field names like this: First_Name, the details area cannot get filled. How can remove an underscore from the header field but could still fill in the details region.

     

    Thanks,

    bullpit

     

     

    Thursday, July 12, 2007 7:35 PM

Answers

  • Never mind, got this one also.

    I changed my report parameters to multivalued and passed two values to each parameter from the code. One (the header field) wihout underscores and the other with underscores.

     

    So my expressions changed like this:

    =Parameters!param1.Value(0) //for header, first value in the string array  

    =Fields(Parameters!param1.Value(1)).Value //for details region, value of 2nd value in string array

    Hope this helps someone...

    bullpit

    Friday, July 13, 2007 1:51 PM

All replies

  • Never mind, got this one also.

    I changed my report parameters to multivalued and passed two values to each parameter from the code. One (the header field) wihout underscores and the other with underscores.

     

    So my expressions changed like this:

    =Parameters!param1.Value(0) //for header, first value in the string array  

    =Fields(Parameters!param1.Value(1)).Value //for details region, value of 2nd value in string array

    Hope this helps someone...

    bullpit

    Friday, July 13, 2007 1:51 PM
  • I'm glad you figured out a solution -- and I think it's a good one, because it allows your column header values to be more flexible than just putting the space back in <s>.  But, I'm curious...

     

    Wouldn't it just have worked to say  =REPLACE(Parameters!param1.Value,"_"," ") for your header values??

     

    >L<

    Sunday, July 15, 2007 3:00 PM
  • Hmmm...Never knew REPLACE existed. will try that and let you know.

    Thanks.
    Thursday, August 2, 2007 3:36 PM