45
Meeting of the Minds 1999 Welcome To... ReportSmith & ADP PC/Payroll For Windows

Meeting of the Minds 1999 Welcome To... ReportSmith & ADP PC/Payroll For Windows

Embed Size (px)

Citation preview

Page 1: Meeting of the Minds 1999 Welcome To... ReportSmith & ADP PC/Payroll For Windows

Meeting of the Minds 1999

Welcome To...

ReportSmith &ADP PC/Payroll For

Windows

Page 2: Meeting of the Minds 1999 Welcome To... ReportSmith & ADP PC/Payroll For Windows

Meeting of the Minds 1999

Welcome To...

SQL Derived FieldsTips And Tricks

Page 3: Meeting of the Minds 1999 Welcome To... ReportSmith & ADP PC/Payroll For Windows

Meeting of the Minds 1999

Presented By

CharlesCook.comSpecializing In

ReportSmith Training & Consulting

[email protected]

Page 4: Meeting of the Minds 1999 Welcome To... ReportSmith & ADP PC/Payroll For Windows

Meeting of the Minds 1999

Overview If Then Else Logic String Functions Functions in Functions Checking Your Syntax Debugging Derived

Fields

Page 5: Meeting of the Minds 1999 Welcome To... ReportSmith & ADP PC/Payroll For Windows

Meeting of the Minds 1999

Overview If Then Else Logic

@DECODE @CHOOSE @IF

Page 6: Meeting of the Minds 1999 Welcome To... ReportSmith & ADP PC/Payroll For Windows

Meeting of the Minds 1999

@DECODE

@DECODE(expr,search1,return1,search2,return2,…,[default])

Equal ComparisonIF expr = search1 THEN return1

Page 7: Meeting of the Minds 1999 Welcome To... ReportSmith & ADP PC/Payroll For Windows

Meeting of the Minds 1999

@DECODE

@DECODE(code,’A’,amount,0)

IF code = ‘A’ THEN amount ELSE 0

Page 8: Meeting of the Minds 1999 Welcome To... ReportSmith & ADP PC/Payroll For Windows

Meeting of the Minds 1999

@DECODE

@DECODE(expr,search1,return1,search2,return2,…,[default])

Looks For Pairs Of Parameters search1,return1, search2,return2

IF expr = search1 THEN return1

ELSE IF expr = search2 THEN return2

ELSE IF expr = searchn THEN returnn

Page 9: Meeting of the Minds 1999 Welcome To... ReportSmith & ADP PC/Payroll For Windows

Meeting of the Minds 1999

@DECODE@DECODE(sex,’M’,’Male’,’F’,”Female’,’?’)

IF sex = ‘M’ THEN ‘Male’ELSE IF sex = ‘F’ THEN ‘Female’ELSE ‘?’

Page 10: Meeting of the Minds 1999 Welcome To... ReportSmith & ADP PC/Payroll For Windows

Meeting of the Minds 1999

@DECODE

@DECODE(expr,search1,return1,search2,return2,…,[default])

Unpaired Parameter Is Default [Optional]

If Default is Omitted and There Is No Match, NULL Is Returned

Page 11: Meeting of the Minds 1999 Welcome To... ReportSmith & ADP PC/Payroll For Windows

Meeting of the Minds 1999

@DECODE@DECODE(sex,’M’,’Male’,’F’,”Female’)

IF sex = ‘M’ THEN ‘Male’ELSE IF sex = ‘F’ THEN ‘Female’ELSE NULL

Page 12: Meeting of the Minds 1999 Welcome To... ReportSmith & ADP PC/Payroll For Windows

Meeting of the Minds 1999

@DECODE

@DECODE(expr,search1,return1,search2,return2,…,[default])

expr May Be Any Data Type searchn Must Be The Same Data

Type As expr returnn Will Be Forced To The

Same Data Type As return1

Page 13: Meeting of the Minds 1999 Welcome To... ReportSmith & ADP PC/Payroll For Windows

Meeting of the Minds 1999

@CHOOSE

@CHOOSE(index,value0,value1,…,valuen) Will Return A Value Based On

The indexIF index <= 0 THEN value0

IF index = 1 THEN value1

IF index = 2 THEN value2

Page 14: Meeting of the Minds 1999 Welcome To... ReportSmith & ADP PC/Payroll For Windows

Meeting of the Minds 1999

@CHOOSE@CHOOSE((date -

startdate),amount,0)IF (date - startdate) <= 0THEN amountELSE 0

Page 15: Meeting of the Minds 1999 Welcome To... ReportSmith & ADP PC/Payroll For Windows

Meeting of the Minds 1999

@CHOOSE@CHOOSE((date -

startdate),amount,0)IF startdate <= dateTHEN amountELSE 0

Page 16: Meeting of the Minds 1999 Welcome To... ReportSmith & ADP PC/Payroll For Windows

Meeting of the Minds 1999

@CHOOSE

@CHOOSE(index,value0,value1,…,valuen) If The index Exceeds The

Number Of Values, The Last Value Is Returned

Page 17: Meeting of the Minds 1999 Welcome To... ReportSmith & ADP PC/Payroll For Windows

Meeting of the Minds 1999

@IF@IF(number,value1,value2)

Return value1 If number Is Not Zero

Return value2 If number Is Zero Or NULL

Page 18: Meeting of the Minds 1999 Welcome To... ReportSmith & ADP PC/Payroll For Windows

Meeting of the Minds 1999

@IFgross_pay / @IF(hours,hours,1)

IF hours <> 0THEN hoursELSE 1

Page 19: Meeting of the Minds 1999 Welcome To... ReportSmith & ADP PC/Payroll For Windows

Meeting of the Minds 1999

@IF@IF(test,’YES’,’NO’)

IF test <> 0THEN ‘YES’ELSE ‘NO’

Page 20: Meeting of the Minds 1999 Welcome To... ReportSmith & ADP PC/Payroll For Windows

Meeting of the Minds 1999

Overview String Functions

@SUBSTRING @TRIM @LENGTH @FIND

Page 21: Meeting of the Minds 1999 Welcome To... ReportSmith & ADP PC/Payroll For Windows

Meeting of the Minds 1999

@SUBSTRING

@SUBSTRING(string,start-pos,length) Returns The Desired Portion Of

string The Substring Starts At start-pos

The First Character Of string Has A start-pos Of Zero

For A Length Of length

Page 22: Meeting of the Minds 1999 Welcome To... ReportSmith & ADP PC/Payroll For Windows

Meeting of the Minds 1999

@SUBSTRING@SUBSTRING(dept,0,3)

dept = 101554Results = 101

@SUBSTRING(dept,3,3)dept = 101554Results = 554

Page 23: Meeting of the Minds 1999 Welcome To... ReportSmith & ADP PC/Payroll For Windows

Meeting of the Minds 1999

@SUBSTRING

@SUBSTRING(string,start-pos,length) If start-pos Is Greater Then The

Length Of string NULL Is Returned

Page 24: Meeting of the Minds 1999 Welcome To... ReportSmith & ADP PC/Payroll For Windows

Meeting of the Minds 1999

@SUBSTRING@SUBSTRING(dept,6,3)

dept = 101554Results = NULL

Page 25: Meeting of the Minds 1999 Welcome To... ReportSmith & ADP PC/Payroll For Windows

Meeting of the Minds 1999

@TRIM@TRIM(string)

Strips Leading And Trailing Spaces From string

Compresses Multiple Spaces Within string Into Single Spaces

Page 26: Meeting of the Minds 1999 Welcome To... ReportSmith & ADP PC/Payroll For Windows

Meeting of the Minds 1999

@TRIM@TRIM(‘ Charles Cook

‘)Returns ‘Charles Cook’

Page 27: Meeting of the Minds 1999 Welcome To... ReportSmith & ADP PC/Payroll For Windows

Meeting of the Minds 1999

@LENGTH@LENGTH(string)

Returns The Length Of string

Page 28: Meeting of the Minds 1999 Welcome To... ReportSmith & ADP PC/Payroll For Windows

Meeting of the Minds 1999

@LENGTH@LENGTH(‘Charles

Cook‘)Returns 12

Page 29: Meeting of the Minds 1999 Welcome To... ReportSmith & ADP PC/Payroll For Windows

Meeting of the Minds 1999

@FIND@FIND(string1,string2,start-pos)

Returns The Starting Position Of string2 Within string1

The Search Begins At start-pos The First Character Of string1 Has

A start-pos Of Zero

Page 30: Meeting of the Minds 1999 Welcome To... ReportSmith & ADP PC/Payroll For Windows

Meeting of the Minds 1999

@FIND@FIND(‘Charles F. Cook’,’.’,0)

Returns 9

Page 31: Meeting of the Minds 1999 Welcome To... ReportSmith & ADP PC/Payroll For Windows

Meeting of the Minds 1999

@FIND@FIND(‘Charles F. Cook’,’oo’,0)

Returns 12

Page 32: Meeting of the Minds 1999 Welcome To... ReportSmith & ADP PC/Payroll For Windows

Meeting of the Minds 1999

Functions in Functions

Execute From The Inside Out The Innermost

Functions Are Resolved First

Page 33: Meeting of the Minds 1999 Welcome To... ReportSmith & ADP PC/Payroll For Windows

Meeting of the Minds 1999

name = ‘ Charles F. Cook ‘

@SUBSTRING(@TRIM(name),0,(@FIND(@TRIM(name),’.’,0) - 2))

Functions in Functions

Page 34: Meeting of the Minds 1999 Welcome To... ReportSmith & ADP PC/Payroll For Windows

Meeting of the Minds 1999

name = ‘ Charles F. Cook ‘

@SUBSTRING(@TRIM(name),0,(@FIND(@TRIM(name),’.’,0) - 2))

@SUBSTRING(@TRIM(name),0,(@FIND(‘Charles F. Cook’,’.’,0) - 2))

Functions in Functions

Page 35: Meeting of the Minds 1999 Welcome To... ReportSmith & ADP PC/Payroll For Windows

Meeting of the Minds 1999

name = ‘ Charles F. Cook ‘

@SUBSTRING(@TRIM(name),0,(@FIND(@TRIM(name),’.’,0) - 2))

@SUBSTRING(@TRIM(name),0,(@FIND(‘Charles F. Cook’,’.’,0) - 2))

@SUBSTRING(@TRIM(name),0,(9 - 2))

Functions in Functions

Page 36: Meeting of the Minds 1999 Welcome To... ReportSmith & ADP PC/Payroll For Windows

Meeting of the Minds 1999

name = ‘ Charles F. Cook ‘

@SUBSTRING(@TRIM(name),0,(@FIND(@TRIM(name),’.’,0) - 2))

@SUBSTRING(@TRIM(name),0,(@FIND(‘Charles F. Cook’,’.’,0) - 2))

@SUBSTRING(@TRIM(name),0,(9 - 2))@SUBSTRING(‘Charles F. Cook’,0,7)

Functions in Functions

Page 37: Meeting of the Minds 1999 Welcome To... ReportSmith & ADP PC/Payroll For Windows

Meeting of the Minds 1999

name = ‘ Charles F. Cook ‘

@SUBSTRING(@TRIM(name),0,(@FIND(@TRIM(name),’.’,0) - 2))

@SUBSTRING(@TRIM(name),0,(@FIND(‘Charles F. Cook’,’.’,0) - 2))

@SUBSTRING(@TRIM(name),0,(9 - 2))@SUBSTRING(‘Charles F. Cook’,0,7)‘Charles’

Functions in Functions

Page 38: Meeting of the Minds 1999 Welcome To... ReportSmith & ADP PC/Payroll For Windows

Meeting of the Minds 1999

Break Your Formula Down

@SUBSTRING(@TRIM(name),0,(@FIND(@TRIM(name),’.’,0) - 2))

Checking Your Syntax

Page 39: Meeting of the Minds 1999 Welcome To... ReportSmith & ADP PC/Payroll For Windows

Meeting of the Minds 1999

Break Your Formula Down

@SUBSTRING(,,)

@TRIM(name)

0

(- 2)

@FIND(,,)

@TRIM(name)

’.’

0

Checking Your Syntax

Page 40: Meeting of the Minds 1999 Welcome To... ReportSmith & ADP PC/Payroll For Windows

Meeting of the Minds 1999

Build It One Step At A Time Hard Code Parts Until You

Understand What Is Going Wrong

@TRIM(name)

Debugging Derived Fields

Page 41: Meeting of the Minds 1999 Welcome To... ReportSmith & ADP PC/Payroll For Windows

Meeting of the Minds 1999

Build It One Step At A Time Hard Code Parts Until You

Understand What Is Going Wrong

@SUBSTRING(@TRIM(name),0,5)

Debugging Derived Fields

Page 42: Meeting of the Minds 1999 Welcome To... ReportSmith & ADP PC/Payroll For Windows

Meeting of the Minds 1999

Build It One Step At A Time Hard Code Parts Until You

Understand What Is Going Wrong

@FIND(@TRIM(name),’.’,0)

Debugging Derived Fields

Page 43: Meeting of the Minds 1999 Welcome To... ReportSmith & ADP PC/Payroll For Windows

Meeting of the Minds 1999

Build It One Step At A Time Hard Code Parts Until You

Understand What Is Going Wrong

@SUBSTRING(@TRIM(name),0,@FIND(@TRIM(name),’.’,0))

Debugging Derived Fields

Page 44: Meeting of the Minds 1999 Welcome To... ReportSmith & ADP PC/Payroll For Windows

Meeting of the Minds 1999

Build It One Step At A Time Hard Code Parts Until You

Understand What Is Going Wrong

@SUBSTRING(@TRIM(name),0,(@FIND(@TRIM(name),’.’,0) - 2))

Debugging Derived Fields

Page 45: Meeting of the Minds 1999 Welcome To... ReportSmith & ADP PC/Payroll For Windows

Meeting of the Minds 1999

Presented By

CharlesCook.comSpecializing In

ReportSmith Training & Consulting

[email protected]