The easiest thing to do is to start Report Builder 3 and select "New Dataset" from the Getting Started wizard;
Report Builder 3: Getting Started Wizard |
Report Builder 3: SQL Editor Window |
SELECT 1 AS VALUE1,
2 AS VALUE2
FROM DUAL
This is a very simple piece of SQL that will just return a single row with two columns called VALUE1 and VALUE2 which contain the values 1 and 2;
Report Builder 3: Sample SQL with Result |
- VALUE3 = VALUE1 + VALUE2, and
- VALUE4 = VALUE1/VALUE2
Click on "Set Options" (in the ribbon bar at the top of the window);
Report Builder 3: Shared Dataset Properties |
Shared Dataset Properties: New Field |
- VALUE3 (Field Name)
- =Fields!VALUE1.Value + Fields!VALUE2.Value (Field Source)
- VALUE4 (Field Name)
- =Fields!VALUE1.Value / Fields!VALUE2.Value (Field Source)
And click "OK" to apply the change.
Re-run the query and you'll notice that your two new fields are NOT being displayed. This is slightly unexpected but if the expression you have entered is incorrect you will see an error message like;
Report Builder 3: Invalid Expression Error |
The Value expression for the field ‘=Fields!VALUE1.Value1 / Fields!VALUE2.Value’ contains an error: [BC30456] 'Value1' is not a member of 'Microsoft.ReportingServices.ReportProcessing.ReportObjectModel.Field'.
You'll notice that I just added a "1" after the Value property name.
Now you've saved the dataset close and re-open Report Builder and this time from the wizard select "New Report" and then "Table or Matrix Wizard", select the dataset you've just saved, click "Next" and you will see;
Report Builder 3: New Table or Matrix Wizard Screen |
Report Builder 3: Successfully Showing Four Fields |
Now, as a final check, if you go through into the Dataset Properties of the Dataset you've just added and look at the fields;
Report Builder 3: Dataset Properties |
1 comment:
Excellent Data Sets of the day !!
Post a Comment