 |
If using Brio 5.x, see Brio 5.x Data Functions.
CONTENTS
Concatenation
To combine two data items into a third "computed" item as a string, use the concatenation string function in either the Query or Results section.
- In Query section, select Request button and then select Query menu (In Results section, select Results menu).
- Select Add Computed Item.
- Name the new data item in the Modify Item dialog box.
- Press the Functions... button on right in dialog box.
- Select String Functions from the Function Categories window in the Functions dialog box.
- Select Concat from the Functions available in the window to the right.
- Complete the table by referencing the first column name (or text) and the second column name (or text).
- Click OK in the Functions dialog box.
- Click OK in the Modify Item dialog box.
- To review/modify the computed item double click on the item name on the Request Line.
Concatenation with a Delimiter
To combine two or more data items into a third "computed" item with a delimiter between the combined data items, use the reference button within the the computed item dialog box in the Query section only.
- In Query section, select Request button and then select Query menu.
- Select Add Computed Item.
- Name the new data item in the Modify Item dialog box.
- Press the Reference button on right in dialog box.
- Reference the topic (table) and first data item and click OK
- Type two vertical bars or pipes, i.e. ||
- Type the delimiter between single quotes, i.e. for a delimiter of a comma followed by a space, type ', '
- Type two vertical bars or pipes, i.e. ||
- Press the Reference button on right in dialog box
- Reference the topic (table) and second data item and click OK.
- Click OK in the Modify Item dialog box.
- To review/modify the computed item double click on the item name on the Request Line.
Count
To retrieve a count of occurrences of a data item in the database, use the count aggregate function in the Query section.
- In Query section, double click the intended item on the Request Line.
- Press the Functions... button on right in dialog box.
- Select Aggregate Functions from the Function Categories window in the Functions dialog box.
- Select Count from the Functions available in the window to the right.
- Complete the table by referencing the column name.
- Click OK in the Functions dialog box.
- Click OK in the Item Properties dialog box.
- To review/modify the computed item double click on the item name on the Request Line.
Count Distinct
To retrieve a count of distinct, unique occurrences of a data item in the database, use the count distinct aggregate function in the Query section.
- In Query section, double click the intended item on the Request Line.
- Press the Functions... button on right in dialog box.
- Select Aggregate Functions from the Function Categories window in the Functions dialog box.
- Select Count Distinct from the Functions available in the window to the right.
- Complete the table by referencing the column name.
- Click OK in the Functions dialog box.
- Click OK in the Item Properties dialog box.
- To review/modify the computed item double click on the item name on the Request Line.
Decode
Similar to the "find and replace" command in word processing, to search for particular values in the retrieved data element and replace with a specified value or a default, use the decode conditional function in the Query or Results section.
- In Query section, double click the intended item on the Request Line (In Results section, select Results menu, select Add Computed Item and name the new data item in the dialog box).
- Press the Functions... button on right in dialog box.
- Select Conditional Functions from the Function Categories window in the Functions dialog box.
- Select Decode from the Functions available in the window to the right.
- Complete the table by adhering to the "expression, search, result, default" format. Reference the data element you wish to decode as your expression followed by a comma, type the value you wish to search for followed by a comma, type the result (replacement) for such a value followed by a comma and a default value or data element to be returned in records that do not contain the value that was specified in the "search" criteria. Many search and result values can be nested within the Decode statement.
- Click OK in the Functions dialog box.
- Click OK in the Modify Item dialog box.
- To review/modify the computed item double click on the item name on the Request Line.
Grouping
To group specified values from one column of data into a third "grouped" column, use the Add Grouped Column function in the Results section.
- In Results section, select the column from which to select values and select Results menu.
- Select Add Grouping Column.
- Name the new grouped column in the Grouped Column dialog box.
- Press New Group button, name the first new group and click OK.
- Complete the table by selecting the desired values from the Available Values window and clicking on the << button to add values to the window.
- Repeat the last two steps as many times as necessary to form all appropriate groups in the new grouped column.
- Click OK in the Grouped Column dialog box.
- To review/modify the grouped column, select the column, right-click and select Modify Column.
To Hours, Minutes, Seconds
To return a length of seconds in Hours:Minutes:Seconds format, use the To Hours, Minutes, Seconds data function in the Query section.
- In Query section, select Query menu, select Add Computed Item and name the new data item in the dialog box.
- In the panel, type To_HHMISS followed by a left paren
- Next, use the Reference button to select Seconds data element from the table and type a right paren.
- Click OK in the Modify Item dialog box.
- To review/modify the computed item double click on the item name on the Request Line.
Name Formatting
To return a string up to 80 characters for a formatted name (different modes allow for different return formats), use the Name Format data function in the Query section.
- In Query section, select Query menu, select Add Computed Item and name the new data item in the dialog box.
- In the panel, type Namefmt followed by a left paren.
- Next, type the Mode letter in single quotes, followed by a comma.
Possible Modes are:
A Smith, J.
B Smith Jr., Dr. John Robert
C Dr. John Robert Smith,Jr. (for Commencement Program. Same as type R except for "," Jr and Sr suffixes.)
D Smith Jr., Dr. John R
F John Smith
G John Smith Jr.
H Dr. John Smith Jr.
I J. Smith
J J. Smith Jr.
L Smith
M John R. Smith
N John R. Smith Jr.
R Dr. John Robert Smith Jr.
S Smith Jr
X John
Y Robert
- Use the Reference button to select the Name data element from the table and type a comma.
- If the Prefix and Suffix data elements are not available in the table:
- Type a set of single quotes, followed by a comma.
- Type a second set of single quotes, followed by a right paren.
Namefmt('M','Table.Name','','')
- If the Prefix and Suffix data elements are available in the table:
- Use the Reference button to select the Prefix data element from the table and type a comma.
- Use the Reference button to select the Suffix data element from the table and type a right paren.
Namefmt('R','Table.Name','Table.Prefix','Table.Suffix')
- Click OK in the Modify Item dialog box.
- To review/modify the computed item double click on the item name on the Request Line.
Nvl
Similar to the "find and replace" command in word processing, to search for NULL values in the retrieved data element and replace with a specified value, use the null value conditional function in the Query or Results section.
- In Query section, double click the intended item on the Request Line (In Results section, select Results menu, select Add Computed Item and name the new data item in the dialog box).
- Press the Functions... button on right in dialog box.
- Select Conditional Functions from the Function Categories window in the Functions dialog box.
- Select Nvl from the Functions available in the window to the right.
- Complete the table by referencing the column name and entering the replacement for a null value.
- Click OK in the Functions dialog box.
- Click OK in the Modify Item dialog box.
- To review/modify the computed item double click on the item name on the Request Line.
Percent of Column
To display a value which represents the row's percent of the column total, use the % of Column data function in the Pivot section. The data element to which the % of Column data function is applied must be numeric. If it is a non-numeric element, such as Um Id, first modify the data element in the Query section by applying the Count data function to the element, i.e.Um Id, on the Request Line.
- In Pivot section, populate the Outliner to display the desired data items.
- Add a Total column by selecting the appropriate column header tab (to the right of the column header) and pressing the sigma button (or right-click and select Add Totals).
- Alt-click on the Total column heading. This selects the Total column and values contained within it.
- Select Pivot menu, select Data Function and select % of Column (or right-click, select Data Function and select % of Column).
Random
To return a random number, use the Random data function in the Query section.
- In Query section, select Query menu, select Add Computed Item and name the new data item in the dialog box.
- In the panel, type Random.Random followed by a left paren
- Next, type the maximum possible random number (for example, 100 would return a random value from 1 to 100, inclusive) and type a right paren.
- Click OK in the Modify Item dialog box.
- To review/modify the computed item double click on the item name on the Request Line.
Rounding
To round numeric data as it is returned to the desktop, use the rounding numeric function in the Query section.
- In Query section, double click the intended item on the Request Line (or select item and select Modify).
- Press the Functions... button on right in dialog box.
- Select Numeric Functions from the Function Categories window in the Functions dialog box.
- Select Round from the Functions available in the window to the right.
- Complete the table by specifying the number or digits to the right of the decimal to which the server should round (use a zero to indicate the return of a whole number).
- Click OK in the Functions dialog box.
- Click OK in the Item Properties dialog box.
- To review/modify the computed item double click on the item name on the Request Line.
Substring
To report part of a data element instead of the entire value in the data element, use the substring string function in the Query or Results section.
- In Query section, select Request button and then select Query menu (In Results section, select Results menu).
- Select Add Computed Item.
- Name the new data item in the dialog box.
- Press the Functions... button on right in dialog box.
- Select String Functions from the Function Categories window in the Functions dialog box.
- Select Substr from the Functions available in the window to the right.
- Complete the table by referencing the column name, the first character you wish to display and the total number of characters you wish to include in the display of the substring.
- Click OK in the Functions dialog box.
- Click OK in the Modify Item dialog box.
- To review/modify the computed item double click on the item name on the Request Line.
Upper & Lower Case
To alter the display of text in a data element returned from the data set in Initial Letter Capitalized style to ALL CAPS, use the Upper Case function in either the Query or Results setion.
- In Query section, double click the intended item on the Request Line (In Results section, select Results menu, select Add Computed Item and name the new data item in the dialog box).
- Press the Functions... button on right in dialog box.
- Select String Functions from the Function Categories window in the Functions dialog box.
- Select Upper from the Functions available in the window to the right.
- Complete the table by referencing the column name.
- Click OK in the Functions dialog box.
- Click OK in the Modify Item dialog box.
- To review/modify the computed item double click on the item name on the Request Line.
To alter the display of text in a data element returned from the data set in ALL CAPS to Initial Letter Capitalized style, use the Initial Caps function in either the Query or Results setion.
- In Query section, double click the intended item on the Request Line (In Results section, select Results menu, select Add Computed Item and name the new data item in the dialog box).
- Press the Functions... button on right in dialog box.
- Select String Functions from the Function Categories window in the Functions dialog box.
- Select Initcap from the Functions available in the window to the right.
- Complete the table by referencing the column name.
- Click OK in the Functions dialog box.
- Click OK in the Modify Item dialog box.
- To review/modify the computed item double click on the item name on the Request Line.
Logic Tips
The following tips will help when creating computed item expressions:
- Item names are not case-sensitive.
- Type the word null (no quotes) into the expression panel to represent null values.
- All text string constant values entered in expressions must be enclosed in double quotes.
- All date constant values entered in expressions must be enclosed in single quotes.
- Numbers can be entered without quotes.
- To join items with a space or other character, simply reference or type items and strings into the expression panel and join them with the + operator (for example, City + ‘, ‘ + State). To join without additional characters, use the Concat function.
- If, then, else logic statements are assembled in natural language form.
For example:
if Stu_Cnt_Current >= Stu_Cnt_Freeze then Stu_Cnt_Current else Stu_Cnt_Freeze
Returns the Stu_Cnt_Current value if that value is greater than or equal to the Stu_Cnt_Freeze value, otherwise it returns the Stu_Cnt_Freeze value.
- Computed items with expressions that yield mixed data type values (for example, if Score > 50 then Score else ‘Fail') default to Char (String) data type.
- In division operations, the divisor may not be null or equal to zero. If a data item serves as the divisor in an expression (for example, 5000 / Units_Sold) and includes null or zero values, first create a computed item using if/then/else logic to remove null and zero values, and then compute the item containing the division operation.
- Two date items may be subtracted, but not added. The Add Month function adds an integer value to a date.
- You may not nest functions inside the Sum, Cume, Chr, and Breaksum functions.
|