Associate a Textbox with a Dataset

  • Hi everyone

    Is it possible to associate a textbox in my SSRS report with a dataset within the same report - or even a dataset in another report (which would be really useful)?

    The reason I want to do this is so I can change the background color of the textbox depending on the value of one of the fields in the dataset using the SWITCH function. In other words i have a field, lets call it TotalSales in Dataset1 which as the name suggests shows the total value of all products sold in the company. I want my textbox to point at this value and then using the SWITCH function determine the background color of the textbox. To complicate things even more would it be possible for it to point at a certain month in the datset? So say the TotalSales field in Dataset1 contains the breakdown of sales by month - would it be possible to look at say Jan 12 or Nov 11, or even the last quarter?

    Hope someone out there can help...

    BO

  • You can scope values in an expression to the dataset. For example, using your names above you can do something like this: (Fields!TotalSales.Value,"Dataset1") to indicate that you want the value returned for TotalSales to be at the Dataset1 level in this expression. I am not sure you could do the same thing with month unless there is a month group that you could scope to.

  • Thanks for getting back to me so quickly...

    There is a month field in the dataset too but how would i write the switch function to include the relevant month? I would always want the most recent month and the date field in the dataset is called NewDate...

  • Try something like this:

    Max(Fields.Month.Value,"Dataset1")

  • Thanks again Daniel but I'm a little confused - not difficult for me!

    I need to bring back the Sales value for the current month - but these are two separate fields in my table so how would the expression combine the two?

    BO

  • Max(Fields.Month.Value,"Dataset1") + Sum(Fields.Amount.Value,"Dataset2")

    Assuming you wanted to Sum the second field

    ==========================================================================================================================
    A computer lets you make more mistakes faster than any invention in human history - with the possible exceptions of handguns and tequila. Mitch Ratcliffe

  • Cheers Andy - I'll give it a go!

  • Your Welcome 🙂

    ==========================================================================================================================
    A computer lets you make more mistakes faster than any invention in human history - with the possible exceptions of handguns and tequila. Mitch Ratcliffe

Viewing 8 posts - 1 through 7 (of 7 total)

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