mis 5208 l5 - working with expressions · § a filter sifts records, only returning those that meet...
TRANSCRIPT
Fox School of BusinessCopyright©2015EdwardS.Ferrara
MIS 5208 – L5 ACL: Work ing with Express ions
EdFerrara,MSIA,[email protected]
AuditCommandLanguageFundamentals
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.
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.
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)
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)
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)
Fox School of BusinessCopyright©2015EdwardS.Ferrara
Express ion Operators
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)
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)
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"
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)
Fox School of BusinessCopyright©2015EdwardS.Ferrara
Express ion Bu i lder
Source:ACLAnalyticsSoftware v12
Fox School of BusinessCopyright©2015EdwardS.Ferrara
App ly ing F i l ters – Dynamic &Programmat icECCcanbefoundunder Tools > Options>Table.
Source:ACLAnalyticsSoftware v12
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)
Fox School of BusinessCopyright©2015EdwardS.Ferrara
Filter&SearchingClassActivity
Fox School of BusinessCopyright©2015EdwardS.Ferrara
F i l ter wi th Condi t iona ls
Howmanycustomershaveacreditlimitofatleast$10,000ANDbelongtoSalesRep00210,00140,or00190?
Fox School of BusinessCopyright©2015EdwardS.Ferrara
F i l ters wi th Express ion Bu i lder
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?
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)
Fox School of BusinessCopyright©2015EdwardS.Ferrara
Uncondit iona l Computed F ie lds
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)
Fox School of BusinessCopyright©2015EdwardS.Ferrara
Thank you.
ComputedFieldClassActivity
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
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.
Fox School of BusinessCopyright©2015EdwardS.Ferrara
Condi t iona l Computed F ie lds
Fox School of BusinessCopyright©2015EdwardS.Ferrara
Funct ions
§ Functionsareusedtoapplycalculationsforawidevarietyofpurposes.
Fox School of BusinessCopyright©2015EdwardS.Ferrara
Between
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
Fox School of BusinessCopyright©2015EdwardS.Ferrara
Computed F ie ld – YEAR() Funct ion
Fox School of BusinessCopyright©2015EdwardS.Ferrara
ClassActivityComputedField
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.
Fox School of BusinessCopyright©2015EdwardS.Ferrara
ABS( ) Funct ion§ Sincepaycheques areissuedmonthly,thepay_per_period foreachemployee
shouldequal1/12thoftheirsalary.§ ClickontheEditViewFilterbuttonatthetopoftheview.§ Entertheexpression:ABS(c_SalaryVariance)>.05.§ ClickOK
Fox School of BusinessCopyright©2015EdwardS.Ferrara
F i xed Po int Ar i thmet ic (Rounding)§ Whencalculating
multiplicationordivision,ACLAnalyticsusesfixed-pointarithmetic.Thismeansthattheresultisroundedtothelargestnumberofdecimalplacesusedintheexpression.
Fox School of BusinessCopyright©2015EdwardS.Ferrara
Questions?