Download presentation
Presentation is loading. Please wait.
Published byHelena Fowler Modified over 9 years ago
1
Chapter 5 Files/Folders needed: \Chapter5\Samples \Chapter5\Labs
2
Understanding Expressions Defining Expressions Working with Report Variables Enhance Formatting by Using Expressions Understanding Lookup, LookupSet, and Multilookup Functions Expression Samples
3
Many uses ◦ Create aggregates ◦ Compute complex values ◦ Dynamically hide and show values ◦ Format based on a value Simple expressions =Fields!Product.Value Expression with multiple functions =IIf((RowNumber(Nothing) Mod 2)=0, "LightGrey“, "LightSteelBlue")
4
Expressions written in Visual Basic (with some unique rules) Many code parts are case sensitive Double quotes (" ") surround string values ◦ Be careful of “Smart Quotes” when copying from MS Word No underscore (_) for line continuation ◦ Use a hard return alone to make code more readable Data type conversions and functions use standard VB naming
5
Accessed through Expression menu options, or the function button. Type code directly in the box, or double-click a value or item Red wavy underlines may indicate errors ◦ Some errors won’t be obvious until you preview the report
6
Options change based on Category field selected
7
Added through Report Properties dialog box Accessed from the Report menu Evaluated once per report Used anywhere in the report
8
Returns data from a second dataset Each requires 4 input parameters ◦ The source key or names to lookup ◦ The destination key or name to match on ◦ The expression to be returned ◦ The destination dataset name
9
=Lookup(Fields!BusinessEntityID.Value, Fields!SalesPersonID.Value, Fields!TotalSales.Value, "SalesPersonTotalSales") Returns one value for each source key of name ◦ For example – returns an account description located in an Excel spreadsheet to match the account code listed in the dataset that is bound to a table.
10
Returns all values that match the source key or name Passes a set (or array) back to the expression ◦ For example, locate in a different dataset, all order dates for a particular customer, and list them as a single value in a new column. =Join(LookupSet(Fields!BusinessEntityID.Value, Fields!SalesPersonID.Value,Fields!SalesOrderID.Value, "SalesOrders“ ), “, “ & vbCrLf)
11
Handles many-to-many relationships between the two datasets The source may be an array that needs to be split ◦ Example – Look up a list of countries where each employee has placed orders. The list of order numbers associated with the employee must be split and then an array of countries will be returned. The source may be a multi-valued parameter
12
Derived columns based on an expression ◦ Add a weight range title to a new column ◦ Add a member level based on early purchases Format based on an expression ◦ Change the background color of every other row ◦ Change the font color for rows with high sales
13
Exercise 1: Using Expressions to Work With Dates Exercise 2: Using Expressions to Manipulate Data
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.