title: SSRS 2008: error message saying my parameter doesn't exist but it clearly does?
body: <p>I have a report that has about 10 parameters and about 10 datasets and one datasource.  I typed alot but I really need help so I figured I would try and provide as much info about the problem as I could right from the start.      </p>
  
  <p>Let's simplify it all and pretend these are the relevant names of everything and that the report gets basic employee information:</p>
  
  <ul>
  <li>Parameters
  <ul>
  <li>facilityID: text in the format of a guid or uniqueidentifier, this is hidden and passed in so that the end user of the report can only view info for their own facility;  Single valued parameter, not blank not null, hidden, text</li>
  <li>startDate: start date range, let's say I want my report to include data starting Jan 1 this year; Single valued parameter, not blank not null, visible, datetime</li>
  <li>endDate:  end of the date range, let's say it's today/now; Single valued parameter, not blank not null, visible, datetime</li>
  <li><strong>viewOption</strong>:  three hard-coded values (label, value) ("Current Employees",1) and ("Past Employees",2) and ("Employees that moved facilities",3); Multi-valued Parameter (so select all is an option), not blank, not null, visible, text</li>
  <li>personID: based on the dataset getListOfNames where the label is the employee name and the value is their personID (guid/uniqueidentifier); Single select, not null, not blank, text and visible<br></li>
  </ul></li>
  <li>My Data Sets 
  <ul>
  <li>getListOfNames:  this gets a list of people that were at the company in the provided date range at the given facility and where their employee status is in the viewOption parameter value (so it can be just one number or up to three).  This is a stored procedure but I have set up it to handle the multi-valued parameter by passing it join(parameter, "~") and then separating it out in the stored proc.  This works on 5 other reports.  </li>
  <li>getReportInfoOnSelectedPerson: main body query; after the user selects the employee they want data on, this takes that personID and the date range and fills the main table. </li>
  </ul></li>
  </ul>
  
  <p>The problem:<br>
  SSRS says viewOption doesn't exist.  But I see it, right there, in the Parameters folder on the left hand side.  I see it when I go to enter an expression under Parameters.  There is no squiggly red line under Parameters!viewOption.value.  But, when I try and put it as a value for a parameter used by the getListOfNames dataset, it errors.  If I put it in the getReportInfoOnSelectedPerson dataset and use it in the exact same way, SSRS is okay with that.  Wtf?  So... I have checked the rdl and everything is fine (where the actual parameter is declared, where it is used in the dataset reference, everything).  It's just this one dataset.  And I have a similar report that uses the same data set, same basic parameters and that report is fine.  I try setting the value of the dataset parameter to 1 or something and that is fine but when I try and set it to Parameter!viewOption.value it errors..... Now, above I said i normally pass the stored proc a Join on the paramater with a tilde ~ but I am trying to keep it simple and either get it to just work in general (either by passing it the first value of the multivalue viewOption parameter or turning that parameter into a single select and just passing the .value) but the join doesnt work either.  All of those things work for the other dataset, which is also a stored proc.  </p>
  
  <p><strong>This is my error:<br>
  An error has occurred during report processing. (rsProcessingAborted)  The Value expression for the query parameter ‘@viewOption’ contains an error: The expression referenced a non-existing parameter in the report parameters collection. (rsRuntimeErrorInExpression)</strong></p>
  
  <p>Which is clearly saying my parameter doesn't exist but I can SEE it... everywhere.  And  if I assign one of the other datasets' parameter values to the viewOption parameter it works without an error.  I've checked the rdl.</p>
  
  <p>I've had this problem before and it was fixed by deleting both the parameter and dataset and creating them again (for safety I renamed both of them).  That didn't work this time.</p>
  
  <p>I am so frustrated.  Please help....   </p>
  
  <p>Code? </p>
  
  <pre><code>      &lt;DataSet Name="getListOfNames"&gt;
        &lt;Fields&gt;
            &lt;Field Name="personID"&gt;
                &lt;DataField&gt;PersonId&lt;/DataField&gt;
                &lt;rd:TypeName&gt;System.Guid&lt;/rd:TypeName&gt;
            &lt;/Field&gt;
            &lt;Field Name="name"&gt;
                &lt;DataField&gt;name&lt;/DataField&gt;
                &lt;rd:TypeName&gt;System.String&lt;/rd:TypeName&gt;
            &lt;/Field&gt;
        &lt;/Fields&gt;
        &lt;Query&gt;
            &lt;DataSourceName&gt;myDataSource&lt;/DataSourceName&gt;
            &lt;CommandType&gt;StoredProcedure&lt;/CommandType&gt;
            &lt;CommandText&gt;getListOfNames&lt;/CommandText&gt;
            &lt;QueryParameters&gt;
                &lt;QueryParameter Name="@fac"&gt;
                    &lt;Value&gt;=join(Parameters!fac.Value,"~")&lt;/Value&gt;
                &lt;/QueryParameter&gt;
                &lt;QueryParameter Name="@bldg"&gt;
                    &lt;Value&gt;=join(Parameters!bldg.Value,"~")&lt;/Value&gt;
                &lt;/QueryParameter&gt;
                &lt;QueryParameter Name="@unit"&gt;
                    &lt;Value&gt;=join(Parameters!unit.Value,"~")&lt;/Value&gt;
                &lt;/QueryParameter&gt;
                &lt;QueryParameter Name="@station"&gt;
                    &lt;Value&gt;=join(Parameters!station.Value,"~")&lt;/Value&gt;
                &lt;/QueryParameter&gt;
                &lt;QueryParameter Name="@startDate"&gt;
                    &lt;Value&gt;=Parameters!startDate.Value&lt;/Value&gt;
                &lt;/QueryParameter&gt;
                &lt;QueryParameter Name="@endDate"&gt;
                    &lt;Value&gt;=Parameters!endDate.Value&lt;/Value&gt;
                &lt;/QueryParameter&gt;
                &lt;QueryParameter Name="@viewOption"&gt;
                    &lt;Value&gt;=Join(Parameters!viewOption.Value, "~")&lt;/Value&gt;
                &lt;/QueryParameter&gt;
            &lt;/QueryParameters&gt;
            &lt;rd:UseGenericDesigner&gt;true&lt;/rd:UseGenericDesigner&gt;
        &lt;/Query&gt;
    &lt;/DataSet&gt;
  
  
  
  &lt;ReportParameter Name="viewOption"&gt;
    &lt;DataType&gt;String&lt;/DataType&gt;
    &lt;DefaultValue&gt;
      &lt;Values&gt;
        &lt;Value&gt;1&lt;/Value&gt;
      &lt;/Values&gt;
    &lt;/DefaultValue&gt;
    &lt;Prompt&gt;View&lt;/Prompt&gt;
    &lt;ValidValues&gt;
      &lt;DataSetReference&gt;
        &lt;DataSetName&gt;viewOptionQuery&lt;/DataSetName&gt;
        &lt;ValueField&gt;value&lt;/ValueField&gt;
        &lt;LabelField&gt;label&lt;/LabelField&gt;
      &lt;/DataSetReference&gt;
    &lt;/ValidValues&gt;
    &lt;MultiValue&gt;true&lt;/MultiValue&gt;
  &lt;/ReportParameter&gt;
  
  
  
  &lt;DataSet Name="viewOptionQuery"&gt;
    &lt;Fields&gt;
      &lt;Field Name="label"&gt;
        &lt;DataField&gt;label&lt;/DataField&gt;
        &lt;rd:TypeName&gt;System.String&lt;/rd:TypeName&gt;
      &lt;/Field&gt;
      &lt;Field Name="value"&gt;
        &lt;DataField&gt;value&lt;/DataField&gt;
        &lt;rd:TypeName&gt;System.Int32&lt;/rd:TypeName&gt;
      &lt;/Field&gt;
    &lt;/Fields&gt;
    &lt;Query&gt;
      &lt;DataSourceName&gt;flamingo&lt;/DataSourceName&gt;
      &lt;CommandText&gt;select 'Other Facility' as label, 3 as value union select 'Past' as label, 2 as value union select 'Current' as label, 1 as value order by value&lt;/CommandText&gt;
      &lt;rd:UseGenericDesigner&gt;true&lt;/rd:UseGenericDesigner&gt;
    &lt;/Query&gt;
  &lt;/DataSet&gt;
  </code></pre>
  
  <p>This is how it is set up and getListOfNames is why the error is throw, if I change</p>
  
  <pre><code>              &lt;QueryParameter Name="@viewOption"&gt;
                    &lt;Value&gt;=Join(Parameters!viewOption.Value, "~")&lt;/Value&gt;
                &lt;/QueryParameter&gt;
  </code></pre>
  
  <p>to</p>
  
  <pre><code>              &lt;QueryParameter Name="@viewOption"&gt;
                    &lt;Value&gt;="1~2"&lt;/Value&gt;
                &lt;/QueryParameter&gt;
  </code></pre>
  
  <p>then it works.... or the value can be just 1 or 1~2~3</p>
  
  <p>However... when I try and put join(Parameters!viewOption.value,"~") as the value for another dataset's query parameter it works and there is no error.  </p>
  
  <pre><code>  &lt;DataSet Name="getReportInfoOnSelectedPerson"&gt;
    &lt;Fields&gt;
      &lt;Field Name="name"&gt;
        &lt;DataField&gt;name&lt;/DataField&gt;
        &lt;rd:TypeName&gt;System.String&lt;/rd:TypeName&gt;
      &lt;/Field&gt; 
      &lt;Field Name="Building"&gt;
        &lt;DataField&gt;Building&lt;/DataField&gt;
        &lt;rd:TypeName&gt;System.String&lt;/rd:TypeName&gt;
      &lt;/Field&gt;
      &lt;Field Name="Unit"&gt;
        &lt;DataField&gt;Unit&lt;/DataField&gt;
        &lt;rd:TypeName&gt;System.String&lt;/rd:TypeName&gt;
      &lt;/Field&gt;
      &lt;Field Name="desc"&gt;
        &lt;DataField&gt;desc&lt;/DataField&gt;
        &lt;rd:TypeName&gt;System.String&lt;/rd:TypeName&gt;
      &lt;/Field&gt; 
    &lt;/Fields&gt;
    &lt;Query&gt;
      &lt;DataSourceName&gt;myDataSource&lt;/DataSourceName&gt;
      &lt;CommandType&gt;StoredProcedure&lt;/CommandType&gt;
      &lt;CommandText&gt;Reports_BasicInfo&lt;/CommandText&gt;
      &lt;QueryParameters&gt;
        &lt;QueryParameter Name="@personID"&gt;
          &lt;Value&gt;=Parameters!personID.Value&lt;/Value&gt;
        &lt;/QueryParameter&gt;
        &lt;QueryParameter Name="@numberINeedToAggregateData"&gt;
          &lt;Value&gt;=Join(Parameters!viewOption.Value,"~")&lt;/Value&gt;
          &lt;rd:UserDefined&gt;true&lt;/rd:UserDefined&gt;
        &lt;/QueryParameter&gt;
      &lt;/QueryParameters&gt;
      &lt;rd:UseGenericDesigner&gt;true&lt;/rd:UseGenericDesigner&gt;
    &lt;/Query&gt;
  &lt;/DataSet&gt;
  </code></pre>
  
  <p>And I already said this, but the stored proc/dataset that throws the error uses a parameter with the same set up in about 5 other reports (I have tried copying and pasting the relevant code sections from working reports but I still get the error).  So, what's wrong with this one?</p>