mis 5208 l5 - working with expressions · § a filter sifts records, only returning those that meet...

34
Fox School of Business Copyright© 2015 Edward S. Ferrara MIS 5208 – L5 ACL: Working with Expressions Ed Ferrara, MSIA, CISSP [email protected] Audit Command Language Fundamentals

Upload: others

Post on 15-Jul-2020

8 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: MIS 5208 L5 - Working with Expressions · § A filter sifts records, only returning those that meet specified conditions; filters evaluate as true or false and return records that

Fox School of BusinessCopyright©2015EdwardS.Ferrara

MIS 5208 – L5 ACL: Work ing with Express ions

EdFerrara,MSIA,[email protected]

AuditCommandLanguageFundamentals

Page 2: MIS 5208 L5 - Working with Expressions · § A filter sifts records, only returning those that meet specified conditions; filters evaluate as true or false and return records that

Fox School of BusinessCopyright©2015EdwardS.Ferrara

Work ing with Express ions§ Expressionsarestatementsusedprimarily

tocreatefiltersandcomputedfields.§ Theyperform:

§ Calculations,§ Specifylogicalconditions,§ Createvaluesthatdonotexistinthedata

file.§ Expressionscanbe:

§ Namedandsavedaspartofaproject§ Createdjustforimmediateuse(temporary)

§ Theoutputofanexpressioncanbereturnedinanyofthefourdatatypes:§ logical§ character§ numeric§ datetime

§ Filters(Logicalexpressions)§ Filtersarelogicalexpressions,that

selectrecordsinyouranalysisfilebasedonaparticular- evaluatingeachrecordasbeing:

§ True§ False

§ Logicalexpressionsrestricttheviewedrecordsbasedontheexpressioncriteria

§ Forexample,youcancreateafilterthatselectsonlyrecordsthatfallwithinaspecifiedrangeofdates.

Page 3: MIS 5208 L5 - Working with Expressions · § A filter sifts records, only returning those that meet specified conditions; filters evaluate as true or false and return records that

Fox School of BusinessCopyright©2015EdwardS.Ferrara

Computed F ie lds§ Acomputedfieldis:

§ Virtual§ Derivedfromacalculationthatreferenceseither

physicalfield(s)and/orpreviouslycreatedcomputedfield(s).

§ Return:§ Character(character)§ Numeric(numeric)§ Date(datetime)§ Logicalvalues§ Conditionalorunconditional.

§ Oncecreated,theycanbetreatedasphysicalfields.

§ ACLAnalyticsevaluatesexpressionsfromlefttoright,accordingtothefollowingrules:§ Operatorsareevaluatedinorderofarithmetic

precedence.§ Useparentheses()tomodifytheorderinwhich

theexpressionisevaluated.§ Eachoperatorworksonlyifitsoperandsareofan

acceptabletype.

Page 4: MIS 5208 L5 - Working with Expressions · § A filter sifts records, only returning those that meet specified conditions; filters evaluate as true or false and return records that

Fox School of BusinessCopyright©2015EdwardS.Ferrara

Us ing Express ions

§ Valuableandflexibletool - usethemto:§ Performawiderangeofcalculations§ Createfilters§ Preparedataforanalysis§ Createcomputedfields

§ ExpressionContent§ Datafields§ Functions§ Literals§ Constants§ Variables§ Arithmeticorlogicaloperators

Source:ACLAnalyticsOnLineUserGuide(https://enablement.acl.com/helpdocs/analytics/12/user-guide/en-us/Default.htm#cshid=using-expressions)

Page 5: MIS 5208 L5 - Working with Expressions · § A filter sifts records, only returning those that meet specified conditions; filters evaluate as true or false and return records that

Fox School of BusinessCopyright©2015EdwardS.Ferrara

Us ing Express ions

Source:ACLAnalyticsOnLineUserGuide(https://enablement.acl.com/helpdocs/analytics/12/user-guide/en-us/Default.htm#cshid=using-expressions)

Page 6: MIS 5208 L5 - Working with Expressions · § A filter sifts records, only returning those that meet specified conditions; filters evaluate as true or false and return records that

Fox School of BusinessCopyright©2015EdwardS.Ferrara

Us ing Express ions

Source:ACLAnalyticsOnLineUserGuide(https://enablement.acl.com/helpdocs/analytics/12/user-guide/en-us/Default.htm#cshid=using-expressions)

Page 7: MIS 5208 L5 - Working with Expressions · § A filter sifts records, only returning those that meet specified conditions; filters evaluate as true or false and return records that

Fox School of BusinessCopyright©2015EdwardS.Ferrara

Express ion Operators

Page 8: MIS 5208 L5 - Working with Expressions · § A filter sifts records, only returning those that meet specified conditions; filters evaluate as true or false and return records that

Fox School of BusinessCopyright©2015EdwardS.Ferrara

F i l ter ing§ Afiltersiftsrecords,only

returningthosethatmeetspecifiedconditions;filtersevaluateastrueorfalseandreturnrecordsthatmeetthespecifiedconditions.

§ Thevaluesinthefiltersyntaxgovernwhichrecordswillbereturnedafterapplyingthefilter.

§ Filtersareconstructedusingacombinationoffieldnames,operators,andstrings,dates,orvalues.

Source:ACLAnalyticsFoundations(https://academy.acl.com/unit/view/id:7465)

Page 9: MIS 5208 L5 - Working with Expressions · § A filter sifts records, only returning those that meet specified conditions; filters evaluate as true or false and return records that

Fox School of BusinessCopyright©2015EdwardS.Ferrara

C reate F i l ters and Quick F i l ters

Source:ACLAnalyticsFoundations(https://academy.acl.com/unit/view/id:7466)

Page 10: MIS 5208 L5 - Working with Expressions · § A filter sifts records, only returning those that meet specified conditions; filters evaluate as true or false and return records that

Fox School of BusinessCopyright©2015EdwardS.Ferrara

Search ing Us ing F i l ters§ SearchforaStartingString

§ Filterscanbeusedtofindspecificwords.Bydefault,searchbehaveslikeawildcard(looksforeveryoccurrencewherethe valuebeginswiththe filterstring;itdoesn’tmatterwhatisafterthestring).

§ Whenthefilter,fieldname="string"isconstructed:§ Thestringbeingsearchedformustbeatthestartofthefield.§ Alphacharacters(A-Z)arecasesensitive

§ Onlycharacterfieldscanbeusedforwordsearches.§ Thesearchcanbeperformedonanycharacterswithinthefield(A-Z,0-9,orsymbols).

• ThewildcardbehavioriscontrolledbyExactCharacterComparisons(ECC).

• IfECCison,theremainderofthefieldvalueafterthesearchforstringmustbeblankinorderforittobepickedup.

• ThetableshowshowvalueswillevaluateifECCisturnedonoroff.

Source:ACLAnalyticsFoundations(https://academy.acl.com/unit/view/id:7467) Consider the filter LastName = "SMITH"

Page 11: MIS 5208 L5 - Working with Expressions · § A filter sifts records, only returning those that meet specified conditions; filters evaluate as true or false and return records that

Fox School of BusinessCopyright©2015EdwardS.Ferrara

Turn ing ECCOn/ Of f ECCcanbefoundunder Tools > Options>Table.

Source: ACL Analytics Foundations (https://academy.acl.com/unit/view/id:7467)

Page 12: MIS 5208 L5 - Working with Expressions · § A filter sifts records, only returning those that meet specified conditions; filters evaluate as true or false and return records that

Fox School of BusinessCopyright©2015EdwardS.Ferrara

Express ion Bu i lder

Source:ACLAnalyticsSoftware v12

Page 13: MIS 5208 L5 - Working with Expressions · § A filter sifts records, only returning those that meet specified conditions; filters evaluate as true or false and return records that

Fox School of BusinessCopyright©2015EdwardS.Ferrara

App ly ing F i l ters – Dynamic &Programmat icECCcanbefoundunder Tools > Options>Table.

Source:ACLAnalyticsSoftware v12

Page 14: MIS 5208 L5 - Working with Expressions · § A filter sifts records, only returning those that meet specified conditions; filters evaluate as true or false and return records that

Fox School of BusinessCopyright©2015EdwardS.Ferrara

Search ing§ SearchforaStartingString

§ Filterscanbeusedtofindspecificwords.Bydefault,thesearchbehaveslikeawildcard(looksforeveryoccurrencewherethe valuebeginswiththe filterstring;itdoesn’tmatterwhatisafterthestring).Whenthefilter,fieldname="string"isconstructed:

§ Thestringbeingsearchedformustbeatthestartofthefield.§ Alphacharacters(A-Z)arecasesensitive§ Onlycharacterfieldscanbeusedforwordsearches.§ Thesearchcanbeperformedonanycharacterswithinthefield(A-Z,0-9,orsymbols)

Source:ACLAnalyticsFoundations(https://academy.acl.com/unit/view/id:7467)

Page 15: MIS 5208 L5 - Working with Expressions · § A filter sifts records, only returning those that meet specified conditions; filters evaluate as true or false and return records that

Fox School of BusinessCopyright©2015EdwardS.Ferrara

Filter&SearchingClassActivity

Page 16: MIS 5208 L5 - Working with Expressions · § A filter sifts records, only returning those that meet specified conditions; filters evaluate as true or false and return records that

Fox School of BusinessCopyright©2015EdwardS.Ferrara

F i l ter wi th Condi t iona ls

Howmanycustomershaveacreditlimitofatleast$10,000ANDbelongtoSalesRep00210,00140,or00190?

Page 17: MIS 5208 L5 - Working with Expressions · § A filter sifts records, only returning those that meet specified conditions; filters evaluate as true or false and return records that

Fox School of BusinessCopyright©2015EdwardS.Ferrara

F i l ters wi th Express ion Bu i lder

Page 18: MIS 5208 L5 - Working with Expressions · § A filter sifts records, only returning those that meet specified conditions; filters evaluate as true or false and return records that

Fox School of BusinessCopyright©2015EdwardS.Ferrara

C lass Act iv i ty§ Howmanycustomershaveacreditlimitofatleast$10000ANDbelongtoSales

Rep00210,00140,or00190?§ Createafilternamed limit_less_10000.§ Usingyoursavedfilter,limit_less_10000,buildafilterthatwilldisplaycustomers

whodonothavealimitofatleast$10000.Whichoperatorwillaccomplishthis?§ Createafilternamesf_limit_less_10000.Usingyoursavedfilter,buildafilterthat

willdisplaycustomerswhodonothavealimitofatleast$10000.Whichoperatorwillaccomplishthis?

§ Howmanycustomershaveacreditlimitlessthan$10000?§ HowmanycustomersbelongtoSalesRep00210?§ Intotal,howmanycustomersbelongtoSalesRep00210,00140,or00190?

Page 19: MIS 5208 L5 - Working with Expressions · § A filter sifts records, only returning those that meet specified conditions; filters evaluate as true or false and return records that

Fox School of BusinessCopyright©2015EdwardS.Ferrara

Uncondit iona l Computed F ie lds

§ Anunconditionalcomputedfieldappliesthesameexpressiontoeveryrecordinthefile.

§ Note:§ Acomputedfieldmustbenamedandalwayssavedtoyourwork

file.§ Example:

§ Inasalestransactionfile,everytransactionrequiresadiscounttobecalculatedonthefinalamountat10%.

§ Theexpressionneedstobeappliedunilaterally(unconditionally)toeveryrecord.

Source:ACLAnalyticsFoundations(https://academy.acl.com/unit/view/id:7470)

Page 20: MIS 5208 L5 - Working with Expressions · § A filter sifts records, only returning those that meet specified conditions; filters evaluate as true or false and return records that

Fox School of BusinessCopyright©2015EdwardS.Ferrara

Uncondit iona l Computed F ie lds

Page 21: MIS 5208 L5 - Working with Expressions · § A filter sifts records, only returning those that meet specified conditions; filters evaluate as true or false and return records that

Fox School of BusinessCopyright©2015EdwardS.Ferrara

Computed F ie lds§ Onlyexistinthetableandarenota

partofthedatasource.§ Mustbenamed.§ Canreturnacharacter,numericor

dateoutput.§ TherulesforusingtheExpression

BuildertocreateacomputedfieldaresimilartothoseforcreatingafilterasdetailedintheExpressionBuilderpage.

ComputedField

Unconditional(Same Expression

Applied)

Conditional(Different Expression

Applied Based On Each Condition)

Page 22: MIS 5208 L5 - Working with Expressions · § A filter sifts records, only returning those that meet specified conditions; filters evaluate as true or false and return records that

Fox School of BusinessCopyright©2015EdwardS.Ferrara

Thank you.

ComputedFieldClassActivity

Page 23: MIS 5208 L5 - Working with Expressions · § A filter sifts records, only returning those that meet specified conditions; filters evaluate as true or false and return records that

Fox School of BusinessCopyright©2015EdwardS.Ferrara

C lass Act iv i ty§ Background:Sincepaychecksareissuedmonthly,thepay_per_period foreachemployee

shouldequal1/12thoftheirsalary:§ Calculatethevariance(difference)betweentheoriginalsalaryfieldandthecomputedfield,

c_SalaryRecalc,createanotherfieldcalledc_SalaryVariance.§ Positivevaluesinthec_SalaryRecalc fieldshouldreflectpayperiodoverpayments.§ SelectEdit>TableLayout.§ ClicktheAddaNewExpressionbutton.Under nameenterc_SalaryRecalc.Click onthef(x)buttonand

enterthesyntaxpay_per_period *12.§ ClickOK.§ Clickthegreencheckmarktoaccepttheentry.§ Don’tclosethetablelayoutwindow.§ Usingthesyntaxpay_per_period *12,createacomputedfield,namedc_SalaryRecalc,torecalculate

thesalaryforeachemployee.§ Nexttotheoriginalsalaryfield,addthec_SalaryRecalc andc_SalaryVariance fieldstoyourview.§ Whatisthetotalvariance?(TOTALcommand).§ Foramoredetailedbreakdownofthevariance,youcanruntheSTATISTICScommandonthe

c_SalaryVariance field.§ Noticehowmanyofthevariancesareforonly4cents?§ Filtertoexcludevariances+/- 5centsusingthefilterc_SalaryVariance >.05ORc_SalaryVariance <-

.05

Page 24: MIS 5208 L5 - Working with Expressions · § A filter sifts records, only returning those that meet specified conditions; filters evaluate as true or false and return records that

Fox School of BusinessCopyright©2015EdwardS.Ferrara

Condi t iona l Computed F ie lds

§ Whendifferentcalculationsneedtobeappliedbasedondifferentconditionswithinthefile,oneexpression,knownasaconditionalcomputedfield,canbecreated.Inaconditionalcomputedfield,valuesarecalculatedconditionally.

§ Note:§ Acomputedfieldmustbenamedandalwayssaved.

§ Inaconditionalcomputedfield,differentvaluesareassignedwhenaspecifiedconditionismet.

§ Everyconditionalcomputedfieldhasa defaultvalue whichisthevaluethatisassignedifnoneoftheconditionsaremet.

Page 25: MIS 5208 L5 - Working with Expressions · § A filter sifts records, only returning those that meet specified conditions; filters evaluate as true or false and return records that

Fox School of BusinessCopyright©2015EdwardS.Ferrara

Condi t iona l Computed F ie lds

Page 26: MIS 5208 L5 - Working with Expressions · § A filter sifts records, only returning those that meet specified conditions; filters evaluate as true or false and return records that

Fox School of BusinessCopyright©2015EdwardS.Ferrara

Funct ions

§ Functionsareusedtoapplycalculationsforawidevarietyofpurposes.

Page 27: MIS 5208 L5 - Working with Expressions · § A filter sifts records, only returning those that meet specified conditions; filters evaluate as true or false and return records that

Fox School of BusinessCopyright©2015EdwardS.Ferrara

Between

Page 28: MIS 5208 L5 - Working with Expressions · § A filter sifts records, only returning those that meet specified conditions; filters evaluate as true or false and return records that

Fox School of BusinessCopyright©2015EdwardS.Ferrara

Between§ Tolearnmoreabouta

specificfunction,selectHelp>Contents andenterthefunctionname.

§ Canbeaccessedfromthefunctionlist,ontherightsideoftheexpressionbuilder.

§ Canbesub-listedintooneofeightcategories:§ all,bit/char,conversion,date

&time§ financial,logical,math§ miscellaneous,andstring

§ Bydefault,thePasteParameterscheck-boxischecked,meaningthat

Page 29: MIS 5208 L5 - Working with Expressions · § A filter sifts records, only returning those that meet specified conditions; filters evaluate as true or false and return records that

Fox School of BusinessCopyright©2015EdwardS.Ferrara

Computed F ie ld – YEAR() Funct ion

Page 30: MIS 5208 L5 - Working with Expressions · § A filter sifts records, only returning those that meet specified conditions; filters evaluate as true or false and return records that

Fox School of BusinessCopyright©2015EdwardS.Ferrara

ClassActivityComputedField

Page 31: MIS 5208 L5 - Working with Expressions · § A filter sifts records, only returning those that meet specified conditions; filters evaluate as true or false and return records that

Fox School of BusinessCopyright©2015EdwardS.Ferrara

YEAR( ) Funct ion§ Createacomputedfield, c_HireYear,thatcalculatestheyearthateachemployee

washiredin.§ Inthe Empmast table,right-clickintheViewandselect Addcolumns.§ Click Expr...§ IntheSaveAstextbox,enter c_HireYear.§ IntheFunctionslist,scrolldowntothe YEAR() functionanddouble-clickonit

sothatitappearsintheExpressiontextbox.§ Double-clickonthe'date/datetime'parametersothatitishighlighted.§ Inthe AvailableFields list,scrolldownto hiredate anddouble-clickonitso

thatitreplaces'date/datetime'intheExpressiontextbox.§ Click Verify toconfirmthatthesyntaxisvalidandthenclick OK tosavethe

fieldandclosetheExpressionBuilder.§ Inthe AddColumns dialog,click OK.

Page 32: MIS 5208 L5 - Working with Expressions · § A filter sifts records, only returning those that meet specified conditions; filters evaluate as true or false and return records that

Fox School of BusinessCopyright©2015EdwardS.Ferrara

ABS( ) Funct ion§ Sincepaycheques areissuedmonthly,thepay_per_period foreachemployee

shouldequal1/12thoftheirsalary.§ ClickontheEditViewFilterbuttonatthetopoftheview.§ Entertheexpression:ABS(c_SalaryVariance)>.05.§ ClickOK

Page 33: MIS 5208 L5 - Working with Expressions · § A filter sifts records, only returning those that meet specified conditions; filters evaluate as true or false and return records that

Fox School of BusinessCopyright©2015EdwardS.Ferrara

F i xed Po int Ar i thmet ic (Rounding)§ Whencalculating

multiplicationordivision,ACLAnalyticsusesfixed-pointarithmetic.Thismeansthattheresultisroundedtothelargestnumberofdecimalplacesusedintheexpression.

Page 34: MIS 5208 L5 - Working with Expressions · § A filter sifts records, only returning those that meet specified conditions; filters evaluate as true or false and return records that

Fox School of BusinessCopyright©2015EdwardS.Ferrara

Questions?