You are on page 1of 3

BusinessObjects Special Topics

Selected Formulas and Functions

Selected Formulas and Functions You can download a BusinessObjects report with examples of several of these formulas.
What You Want to Do Format/Example Notes

Calculate and display a percentage of an object Convert a c#aracter string to a date

=Sum(<Sales revenue>*0.3 !

"#e percent must be preceded by a 0 (i.e.$ %0.3&! if a decimal point is used. "#e single value or variable is follo/ed by t#e e)isting format of t#e string. "#is function can be used in If Then Else statements. 0f t#e variable t#at follo/s Then is date1type$ t#e variable t#at follo/s Else must also be date1type. "#is function can be used in If Then Else statements. 0f t#e variable t#at follo/s Then is numeric$ t#e variable t#at follo/s Else must also be numeric. "#is function /or5s /it# bot# constants and variables.

="o'ate(c#aracter$format! ()ample *+ ="o'ate(%,0030*30&$%yyyymmdd&! -esult+ 0*.30.,003

Convert a c#aracter string to a number

="o2umber(c#aracter! ()ample+ ="o2umber(%334&! -esult+ 334.

Convert a date to a c#aracter string so t#at it is compatible /it# ot#er elements in a formula

=6ormat'ate(date$ string format! ()ample+ =6ormat'ate(<7pplication'ate>$ %mm.dd.yyyy&!

"#e string format must be enclosed in 8uotes. "#is function /or5s /it# bot# constants and variables. 9se t#is function /#en you /ant to concatenate te)t /it# a variable. "#e variable must be c#aracter1type.

Convert a number to a c#aracter string

=6ormat2umber(number$string format! ()ample+ =6ormat2umber(<(ff Se8 :>$%0&!

"#e string format must be enclosed in 8uotes. "#is function /or5s /it# bot# constants and variables. 9se t#is function /#en you /ant to concatenate te)t /it# a variable. "#e variable must c#aracter1type.

Convert upper case to lo/er case (or vice versa! Count t#e number of <eroes or null values in a column

=;o/er(<2ame>! =9pper(<2ame>!
=If <mycolumn> = 0 or IsNull(<mycolumn>) Then 1 else 0

"#e ;o/er(! function displays a c#aracter string in lo/er case /#ile t#e 9pper(! function displays t#e string in upper case. "#is formula returns a %*& anytime a blan5 or <ero appears in t#e specified column. Create a variable /it# t#is formula$ t#en insert a sum on t#e variable to count all occurrences of null or <ero.

3.,0.,003

BusinessObjects Special Topics

Selected Formulas and Functions

What You Want to Do

Format/Example

Notes

Create a table /#ere every ot#er ro/ is s#aded

Variable formula: ==od(;ine2umber(!$ ,! lerter: <2e/ >ariable> = *

*. Create a variable /it# t#e formula displayed at left. "#e formula c#ec5s t#e line number for eac# ro/ and returns a value of * for any ro/ /it# a line number t#at is evenly divisible by a value of ,. ,. ?ig#lig#t all columns of t#e table (but not t#e #eaders!. Create an alerter based on t#e ne/ variable /#ic# s#ades every ro/ for /#ic# t#e value of t#e variable is *. 9nder !ell !ontent" Format#$ go to Shadin$ and select t#e desired s#ading option.

Create a variable t#at displays first name and anot#er t#at displays last name based on a variable t#at displays ;7S" 27=($60-S" 27=($ e.g. '@($A72(

%ast name: =SubStr(<(mp2ame> $* $ (Bos(<(mp2ame> $C$C!1*!! First name: =SubStr(<(mp2ame> $(Bos(<(mp2ame> $ C$C!!D* $;engt#(<(mp2ame>!1 (Bos(<(mp2ame> $ C$C! !! First name &for 'ariable (ith a space after the comma): =SubStr(<(mp2ame> $(Bos(<(mp2ame> $ C$C!!*+ $;engt#(<(mp2ame>! 1(Bos(<(mp2ame> $ C$C!!

"#e Substr(! function e)tracts a se8uence of c#aracters from a c#aracter string. "#e first formula says+ start at position *$ display all c#aracters up to one position before t#e comma. "#e second formula says+ start one c#aracter past t#e comma and display t#e number of c#aracters t#at results from t#is calculation+ t#e total number of c#aracters in t#is field minus t#e position number of t#e comma. Note+ 0f t#ere is a space after t#e comma$ t#e first name formula s#ould start , c#aracters after t#e comma. -eturns t#e calculation performed on data /it# all filters on t#e data ignored. "#e page number /ill only display correctly in Bage ;ayout vie/ (>ie/$ Bage ;ayout!. "#e e)ample uses t#e 6ormat2umber(! function to convert t#e page number to a c#aracter string and concatenates t#e number /it# te)t. ()ample+ %Bage *.& 9se t#e Number tab of t#e !ell Format dialog bo) to format t#e date. Select Insert" Special Field" Date and Time" %ast ,efresh to insert t#is formula automatically.

Create calculations t#at ignore filters on a document 'isplay t#e current page number

=2o6ilter(formula! ()ample+ =2o6ilter(=a)(<Euantity sold>!! =Bage(! ()amples+ =&Bage & F 6ormat2umber (Bage(!$ C:C!

'isplay t#e last time a document /as refres#ed

=;ast()ecution'ate(data provider! ()ample+ =;ast()ecution'ate(CEuery * /it# (67S?0@2C!

3.,0.,003

BusinessObjects Special Topics

Selected Formulas and Functions

What You Want to Do

Format/Example =DocumentName() Example: =Su str(DocumentName() !1 ! "en#th(DocumentName())$%)

Notes

'isplay t#e name of t#e document

"#e e)ample displays t#e document name /it#out t#e .rep e)tension. 0t uses t#e SubStr and ;engt# functions to ta5e a string from t#e document name$ starting in position *$ returning t#e lengt# of t#e document name minus t#e last G c#aracters. Select Insert" Special Field" -uer. /rompt from t#e main menu to insert t#is formula automatically. 0n ()ample *$ t#e data provider name is #ard coded and /ould #ave to be edited if t#e 8uery name /ere c#anged. ()ample , uses t#e 'ataBrovider(! function /#ic# re8uires t#at you specify a variable (in t#is case$ <State>!. C#ec5s /#et#er a constant or variable is empty. "#e e)ample can be used to define a formatted filter and /ill #ide all ro/s in /#ic# t#e specified field is empty. Select Format" Filters$ select t#e table$ clic5 dd#" select variable to filter$ clic5 Define#$ type t#e formula. 0s2ull(! can also be used in an 0f "#en (lse statement. "#e variable t#at follo/s %"#en& must be t#e same data type as t#e variable t#at follo/s %(lse.&

'isplay user response to a prompt.

=9ser-esponse(data provider$ prompt! ()ample *+ =9ser-esponse (CEuery * /it# (67S?0@2C $ Center stateC! ()ample ,+ =9ser-esponse ('ataBrovider(<State>! $ CstateC!

Suppress blan5 values in a column

=0s2ull(c#aracter string or number or date! ()ample+ =2ot 0s2ull(<(mpl0d>! "o suppress <eroes rat#er t#an nulls$ use t#is formula+ =<(mpl0'> <> 0. ()ample of 0f "#en (lse statement+ =0f 0s2ull(<'ept0'>! "#en <7cct Hrp> (lse <'ept0'>

3.,0.,003

You might also like