Vous êtes sur la page 1sur 9

ACL Help: Search on: o Connect o Using variables in place of constants o Reference guide o Processing multiple-record-type files o Some

examples of functions o ACCEP ! dialog boxes o "efine #indo$s %&&&: #indo$s %&&& Command Reference 'ain Page

ACL Script
ACCEP A0E 12 :E #EE+ 12
CA-CU-A E

ACCEP (Enter the name of the table ( ) v*table*name )PE+ ,v*table*name, A0E1 3+4)3CE*"A E5 6%&&&&7&762 A0E1date 85cutoff*date*yyyymmdd92 Afing Periods: ools5 o)ptions5 "ate tab :E #EE+ 1A-- R3'1C)"ES25 ;<&=5 ;<>=2
CA-CU-A E Sale*price - Unit*cost AS ('argin(

to create interactive scripts that pause to display a dialog box that prompts for information that AC- uses in subse.uent processing/ A0E1 2 returns a numeric value denoting the age difference in days bet$een t$o dates/ #hen you omit the second parameter5 AC- uses the current system date/ :E #EE+1 2 returns inclusive 1true2 if value is bet$een minimum value and maximum value

C-ASS3?@ C-EA+1 2 cleaning Command Command -ine C)U+ C)U+ C )" 1 2 CU'3P' 1 2 "E?3+E A:-E ":
"E?3+E ?3E-"

C-ASS3?@ )+ PostActivity ) SCREE+ C-EA+1(")E5 A)B+CC7&%DE7%<7(5 (5(2 F (")E ( A-- R3'1C-EA+1 SU:S R1 ?%5 %5 H& 25 (6(22 #indo$ -9 Sho$ Command -ine #indo$ -9 Command -ine -9 Right mouse clicG I/ C)U+ 3? A-- R3'1PostActivity2 F (CA+CE-( C)U+ 83? test9 8#B3-E test9 8?3RS J +EK range9 C )"1field5(@@"""(2

searches for invalid characters in string5 replaces them $ith characters $ith blanGs/

Use the Count command to count the number of records in the current table5 or only those that meet a specified test condition/
converts a character or numeric expression into a valid date expression/ Calculates the amount of interest paid on a loan during a specified period Use "E?3+E A:-E ": to access server-based tables/
"E?3+E ?3E-" Sales*tax C)'PU E" /&> L Sale*amount 3? State F (CA(

"3A-)0

"3A-)0 1"3A-)0 3 -E S R3+01v*total57&2 BE30B H2

"3SP-A@ PR3'AR@
DO SCRIPT
"UP-3CA ES

DO SCRIPT ImportTable
"UP-3CA ES )+ 3+4)3CE*+) ) BER 3+4)3CE*+) ) SCREE+ PRES)R "UP-3CA ES )+ SU:S R3+01UPPER1+ame25 75 <2 ) (+e$?ile/?3-( PRES)R

Evaluate EK RAC ?3+" ?3- ER ? @PE 12 0R)UP

Se.uence EK RAC 4alue P3C (E5EEE5EEE/EE( ) (+e$*table( ?3+"1CUS +)5 ;%%=2 SE ?3- ER UNIT_COST > 1000 ") Script*7 3? ? @PE1(Amount(2 F (+(
)nly record-based commands and certain script operation commands are

Evaluation starts $ith sample Size5 then based on sample SiMe $e do Sample5 and after that $e Evaluate the sample
3ndexed ro$ Cannot save filtered table 1but can only sampled2 ? @PE1 2 returns a value to identify a type of field5 or other item
A0E5 ASS30+5 C-ASS3?@5 C)''E+ 5 C)U+ 5 E-SE5 E+"5 EKP)R 5 EK RAC 5

appropriate for use $ithin a group/

B3S )0RA'5 A)3+5 -3S 5 -))P5 'ER0E5 PR)?3-E5 REP)R 5 SENUE+CE5 S A 3S 3CS5 S RA 3?@5 SU''AR3OE5 ) A-5 4ER3?@/

3? 3mport

3? v*counter 9 7& C-ASS3?@ )+ Customer*number v*.uantity F 7 3? v*counter 8 7& 3mport of the vie$ 4ie$s can be imported:

o o o

ProPect -9 right mouse clicG-9 Properties -9 3mport able -9 right mouse clicG-9 Properties -9 4ie$ -9 3mport 3ndexesQ

3'P)R

3'P)R "E-3'3 E" ) "ec7D ("ec7D/fil( ?R)' (C:RAC"ataRAclBelpRtest"ec7H*SColumn/txt( & SEPARA )R (5( NUA-3?3ER (6( C)+SECU 34E S AR -3+E 7 ?3E-" (?ield*7( C A 7 "EC & #3" T P3C (( AS (( ?3E-" (?ield*%( C A > "EC & #3" 7> P3C (( AS (( ?3E-" (?ield*<( C A %S "EC & #3" 7< P3C (( AS (( ?3E-" (?ield*S( C A <> "EC & #3" 77 P3C (( AS (( ?3E-" (?ield*H( + A SD "EC & #3" D P3C (( AS ((

Use 3'P)R in scripts to import data from an external so -eila&5 4ladimir&5 'atthe$&5 Alex&5 -eila%5 4ladimir%5 'atthe$%5 Alex%5 -eila<5 4ladimir<5 'atthe$<5 Alex<5 3mportant: /?3- file creates the follo$ing 1no separator2: -eila& 4ladimir& 'atthe$& Alex& -eila% 4ladimir% 'atthe$% Alex% -eila< 4ladimir< 'atthe$< Alex<

3ndex -EA"3+0 12 -))P 'AP 12 'A CB 12 'ESSA0E


')"1 2

"ata -9 Create 3ndex 1-EA"3+01 ContractAmount5 7 2 F 6%62 'AP 1A-- R3'1CAR"+U'25 ;EE=2 'A CB 1A-- R3'1C)"ES25 ;<&=5 ;<>=2 PAUSE ( ext= IIor PAUSE message 83? test9 ) A- A-- +EK 7& +) 'AP 1A-- R3'1CAR"+U'25 ;EE=2 CostPer@ear 89 & A+" ContractAmount 89 &
S R3+01Cust5 D2 or S R3+01-7%H/%5 7&5 (1E5EEE/EE2(2 F ( 17%H/%&2(

Use command $ithin a 0R)UP command to process a record more than once 3s all fields length % digitsQ 'ultiple filters
')"1 2 divides t$o numbers and returns the remainder/

+EK +) 'AP 12 +ot Oero number-9string


)CCURS1 2

3n the example5 +EK causes the command to terminate after 7& records #hich records are not of % digitsQ 3f the resulting string is shorter than length5 leading blanGs are added/ 3f the resulting string is longer than length5 leading characters are truncated/
Use )CCURS1 2 to find out ho$ many times ;+e$ @orG= occurs in an address field/

Profile

Use the Profile command to provide summary statistics on one or more numeric fields in a table/ Profile is used primarily to determine minimum5 maximum5 absolute5 and total field values 1as appropriate2 before issuing the Stratify5 Bistogram5 or Sample commands/

Profile provides the follo$ing information for numeric fields: otal value5 Absolute value5 'inimum value5 'aximum value o turn this option on5 select ools from the menu bar and choose )ptions/ ClicG the able tab and select Automatically Profile on )pen/

Profile Automatic ProPect

3f the Automatic Profile interface option is turned on5 ACautomatically produces a profile of all the numeric fields in a table each time a ne$ table is opened/ he profiles can be vie$ed in the command results/

(C:RProgram ?ilesRAC- Soft$areRAC- 4ersion ERAC-#in/exe( (C:RAC"ataRSampleRSample/acl(


Right mouse clicG on Script ?older -9 +e$ I

o autoload an ACL proPect5 enter the proPect name after the AC- executable path name in the command line/ 3f the document is not in the $orGing directory5 you must include the path name/
o run a script offline: 3f you do not provide a full path to the script5 first navigate to the directory $here the script is located/ )n the command line5 enter the executable5 the -s parameter5 and the name of the script file you $ant to run offline/ aclse/exe -s total*value/bat 3f the specified script file name does not include the default AC- script extension5 /:A 5 AC-

Script #indo$

Scripts offline

Scripts: @ou can run only one script at a time, althou h the script you are runnin can call other scripts/

includes the extension $hen it searches for the file/ 3f the script is not in your $orGing directory5 you must provide a full path: aclse/exe -s ;C:RAC- "ataRAclBelp3mport"elimited/:A ( call (C:RProgram ?ilesRAC- Soft$areRAC- ERAC-#in/exe( -s 6C:RAC"ataRAclBelp3mport"elimited/:A (

Scripts e!ecute

o execute a script $hen autoloading an AC- proPect5 enter the parameter Ub follo$ed immediately by the script name/ "o not enter a space bet$een Ub and the name of the script/ ?or example5 to run the script ?ind*duplicates $hen autoloading the #orGbooG proPect5 the command line reads as follo$s: (C:RProgram ?ilesRAC- Soft$areRAC- 4ersion ERAC-#in/exe( (C:RAC- "ataR#orGbooGR#orGbooG/acl( Ub?ind*duplicates @ou can combine variables and scripts/ ?or example5 to initialiMe the variable 'ateriality and execute the script ?ind*duplicates $hen autoloading the #orGbooG proPect5 the command line appears as follo$s: (C:RProgram ?ilesRAC- Soft$areRAC- 4ersion ERAC-#in/exe( (C:RAC- "ataR#orGbooGR#orGbooG/acl( Uv'aterialityF7&&&& Ub?ind*duplicates Vecho off rem (comment call (C:RProgram ?ilesRAC- Soft$areRAC- ERAC-#in/exe( (C:RAC- "ataRAclBelpRAclBelp/AC-( Ub3mport"elimited exit

:ecause AC- executes command line parameters in the order in $hich they appear5 the name of the AC- proPect must precede any scripts/ he command is executed according to the order specified in the command line/ he above example $ill: -aunch AC-/ -oad the #orGbooG proPect/ Set the variable 'ateriality to 7&5&&&/ Run the ?ind*duplicates script/

)pen AC-5 open AclBelp proPect5 call script 3mport"elimited to read K file5 extract to ?3- file

Search
SENUE+CE

"ata5 search/ After indexing: 'oved to record 7H if Wlocate recordX selected type: 7H 1)+-@ 3+"EK2 of record #hen ;-ocate if ; is selected5 ype NUA+ 3 @ F %< / o turn off command logging $hile you repeat a series of commands 7&& times: v*counter F & SE ECB) +)+E ") Repeat*script #B3-E v*counter 8 7&& SE ECB) )+ Use the SE command to change user options in AC-/ urning off command logging means that the commands and results that do not appear in the command log $ill be unavailable for future revie$/ herefore5 remember to turn command logging bacG on/ he best $ay is to enter both SE ECB) +)+E and SE ECB) )+ at the same time/ hen insert the commands you do not $ant logged bet$een these t$o lines/ SE ECB) Y)+J+)+EZ

SE

Statistics

he Statistics command also populates a number of system variables/


S RA 3?@ )+ CRE"-3' SU: ) A- ?3+CB0 '3+3'U' 7&& 'AK3'U' %&& 3+ ER4A-S 7& ) SCREE+

?or specified fields5 the Statistics command provides: "ecord counts, field totals, and avera e field values for positive, nil, and ne ative field values# ives positive, ne ative, zero numbers$ Absolute value, "an es, Hi hest and lo%est field values
Stratify command to count the number of records falling into specified intervals 1strata2 of numeric field or expression values5 as $ell as to subtotal one or more fields for each stratum 4A-UE1string5 decimals25 converts character expressionUfield into numeric e.uivalent

S RA 3?@
string-9number

4A-UE13+4)3CE*+)5 <2

SU:S R
SU:S R3+0

SU:S R 1A-- R3'1C)"ES25 75 S2 SU:S R3+01UPPER1+ame25 75 <2 [ S R3+01Salary5 H2/


SU:S R3+01UPPER1+ame25 75 <2 [ S R3+01Salary5 H2

Substring Read first S chars 1from 7 to S2

ES 1 2 ips

SU:S R1 otal*Active*Employees*for*%&&5 %5 % 2 ES 1byte*position5 string2

Examines record to see if a character string starts at positions specified by byte posit/ Run WcountX before sampling\ @ou can enter commands in uppercase or lo$ercase5 or a combination of both/

&otal
4ariables 'enu: Edit -9 4ariables

Use the &otal command to total 1sum2 numeric fields or expressions in the active table/ Edit ( 'ariables/ AC- displays the 'ariables dialog box/
3s a set of field definitions that have been saved for reuse $ith other tables/

'ariables
#orGspace

SU:S R1 otal*Active*Employees*for*%&&5 %5 % 2 A-- R3'1C-EA+1 SU:S R1 ?%5 %5 H& 25 (6(22 3'P)R "E-3'3 E" ) "ec7D ("ec7D/fil( ?R)' (C:RAC- "ataRAclBelpRtest"ec7H*SColumn/txt( & SEPARA )R (5( NUA-3?3ER (6( C)+SECU 34E S AR -3+E 7 ?3E-" (?ield*7( C A 7 "EC & #3" T P3C (( AS (( ?3E-" (?ield*%( C A > "EC & #3" 7> P3C (( AS (( ?3E-" (?ield*<( C A %S "EC & #3" 7< P3C (( AS (( ?3E-" (?ield*S( C A <> "EC & #3" 77 P3C (( AS (( ?3E-" (?ield*H( + A SD "EC & #3" D P3C (( AS (( -eila&65 -eila%65 -eila<65 6-eilaS65 64ladimir&65 64ladimir%65 64ladimir<65 64ladimirS65 6'atthe$&65 6Alex&65 6'atthe$%65 6Alex%65 6'atthe$<65 6Alex<65 6'atthe$S65 6AlexS65

ACL Script E!amples o compute and then display the results of your calculation5 use CA-CU-A E/
Belp ACAuto-executing scripts Creating a script from the command log "3SP-A@ Example 0uidelines for $riting scripts Reference guide Some examples of functions Using the "ialog :uilder Using variables #riting AC-Script applications "efining a server data file )":C
hese conventions are used to describe the AC-Script syntax of commands and functions: 'onospace: "enotes command syntax used in the command line or in a script/ 'onospace italic: "enotes user-specified items such as field names/ Angle bracGets 8 9: "enote optional command parameters or choices/ :races Y Z: Enclose a set of options from $hich one must be chosen/ :ars J J J : 4ertical bars separate options/ Ellipsis /// 3ndicates that the preceding item may be repeated/

AC-Script conventions

-))P

0R)UP v*counter F & v*total F & -))P #B3-E v*counter 8 7&& C)''E+ v*total F v*total [ )??SE 13+4)3CE*A')U+ 5 v*counter L H2 v*total F v*total [ 3+4)3CE*A')U+ v*counter F v*counter [ 7 E+" E+" "3A-)0 1"3A-)0 3 -E S R3+01v*total57&2 BE30B H2
)PE+ )riginal* able SE -)0 ) emp*-og "3SP-A@ SE -)0 3'P)R PR3+ ) (+e$*?ield*+ames%( (+e$*?ield*+ames%/?3-( ?R)' ( emp*-og/-)0( SER4ER 7 & REC)R" ("etail( & 7 & ES & % A 75757 & (E( ES 7 & A 7575& & (-og( ES 7 & A 7575& & (+ame( ES 7 & A 7575& > (S$itching( ?3E-" (full*record( C A 757 S3OE 7&&57 "EC & #3" DD P3C (( AS (( )PE+ +e$*?ield*+ames "E?3+E ?3E-" field*name C)'PU E" SU:S R1SP-3 1full*record5 ( (5 725 75 <<2 EK RAC field*name ) (+e$*field*names<( S)R )+ field*name " ) (+e$*?ield*+ames( "E-E E ?)R'A (+e$*?ield*+ames%( )] "E-E E (+e$*?ield*+ames%/?3-( )] "E-E E ?)R'A (+e$*?ield*+ames<( )] "E-E E (+e$*?ield*+ames</?3-( )] "E-E E emp*-og/-)0 )]

0R)UP v*counter F & v*total F & -))P #B3-E v*counter 8 7&& v*total F v*total [ )??SE 1Amount5 v*counter L H2 v*counter F v*counter [ 7 E+" E+"

?ieldUcolumn names and attributes of the original table5 and convert them into ro$s

he above script $ill taGe an existing table and create a ne$ table/ he ne$ table $ill taGe the field names and attributes of the original table5 and convert them into ro$s/ 3n other $ords: able ()riginal*table( has the follo$ing fields: -ast*+ame5 ?irst*+ame5 "):5 and Age/ he ne$ table5 (+e$*?ield*+ames( $ould have records $ith the follo$ing names: -ast*+ame5 ?irst*+ame5 "):5 and Age/

Comment ** NOTICE: ** ACL provides the attached script "as is" and free of charge. ** ACL makes no warranties or representations with respect to ** the script inc!"ding its #"a!it$ or fitness for a partic"!ar ** p"rpose. %o" "nderstand and acknow!edge that $o" ass"me a!! ** risk of !oss or damages which ma$ arise from $o"r "se or ** ina&i!it$ to "se the script. EN' Comment ***** This wi!! a!!ow the &atch to overwrite previo"s res"!ts. (ET (A)ET% O)) Comment ***** *rompt for the Ta&!e name and n"meric fie!d name. Accept "(e!ect Ta&!e Name" )IEL'( "+f" TO ,-I)'NA.E O*EN /,-I)'NA.E/

ACCE*T "(e!ect N"meric )ie!d Name" )IEL'( "N" TO ,-N)ie!dName Comment ***** (ort the fi!e on the n"meric fie!d and co"nt the n"m&er of written records. (O0T ON /,-N)ie!dName/ TO "Temp)i!e" O*EN v-0ecords120ITE3 Comment ***** Locate the .edian va!"e for an odd n"m&er of va!"es and disp!a$ it. LOCATE 0ECO0' v-0ecords45 I) .O'6v-0ecords 5713 *A8(E ".edian va!"e: "9ALLT0I.6(T06/,-N)ie!dName/ 3577 Comment ***** Locate the second record for the .edian va!"e for an even n"m&er of va!"es v-)irst1/,-N)ie!dName/ I) .O'6v-0ecords 571: LOCATE 0ECO0' 6v-0ecords45793 I) .O'6v-0ecords 571: v-.edian16/,-N)ie!dName/9v-)irst745.:: I) .O'6v-0ecords 571: *A8(E ".edian va!"e: "9ALLT0I.6(T06v-.edian 3577 Comment ***** Open the origina! fi!e and de!ete the temporar$ fi!es prod"ced. O*EN /,-I)'NA.E/ 'ELETE "Temp)i!e.)IL" O; 'ELETE )O0.AT Temp)i!e O; (ET (A)ET% ON ca!c"!ate and disp!a$ it.

Counting records $hen filtering otal transaction amounts: AnalyMe5 Classify AnalyMe5 Count Records Extract fields to ane$ table: "ata5 Extract "ata Export: -

"ata5 Export

)ritin ACLScript applications


4irtually all AC- commands can be executed in a script/ @ou can create a script to analyMe data using a specific series of commands5 and then reuse the script later/ :y creating standard5 repeatable applications5 you $ill realiMe significant savings of time and resources in your data analysis proPect/ here is more than one $ay to create a script/ #rite a script in the script editor 1manually or using Syntax Capture2/ Create a script from the command log/ Create a script from the table history/ #ith the ne$ table open5 select ools from the menu bar and choose Create Script from able Bistory/ 3f a default vie$ is active5 AC- prompts you to rename the vie$/ Record a script $ith the Script Recorder/

http:UU$$$/auditnet/orgU http:UU$$$/pentana/comUbooGshop/html

Autoloadin an ACL pro*ect o autoload an ACL proPect5 enter the proPect name after the AC- executable path name in the command line/ 3f the document is not in the $orGing directory5 you must include the path name/ (C:RProgram ?ilesRAC- Soft$areRAC- 4ersion ERAC-#in/exe( (C:RAC- "ataRSampleRSample/acl(

Samplin base: +onetary unit samplin ,+US- . "ecord samplin


he sampling base is the unit used to dra$ the sample/ AC- uses one of t$o sampling bases: +onetary unit samplin ,+US+US uses the absolute value of a field in the record to determine %hich records are selected / #hen using a monetary unit base5 the liGelihood that a given record $ill be selected is directly proportional to the siMe of the item5 unless that item is affected by top stratum cutoff/ Use a monetary unit samplin base if you %ant to e!press a dollar confidence relatin to the iven population, for example5 that total errors do not exceed ^75&&&5&&&/ #ith a monetary unit sampling base5 the data is treated as a stream of dollars5 actually expressed in cents/ Each dollar has an e.ual chance of selection5 and $hen a dollar is selected5 the item containing the dollar is output/ he population is the absolute value of all the dollars in the table/ he interval you specify is the number of dollars bet$een each selection/ 0iven this sampling base5 a ^75&&& item is 75&&& times more liGely to be selected than a ^7 item because a ^75&&& item contains 75&&& times as many dollars5 each of $hich is e.ually liable to be selected/ his selection method biases the sample to$ards greater dollar items/ "ecord samplin A record base treats each record e/ually, usin a nominal value of 0/ his results in a sample that is not biased by being based on the values in a record5 so each record has an e.ual chance of being selected/ Use a record sampling base if you $ant to express confidence as a percentage relating to the given population5 for example5 that the error rate does not exceed <,/

#ith a record sampling base5 the data is treated as a stream of records $ith each record having an e.ual chance of selection/ he population is the number of records in the table/ Conse.uently5 a ^75&&& item and a ^7 item have an e.ual chance of being selected5 since each item is only one record and each record has an e.ual chance of selection/

Samplin %ith and %ithout replacement


#hen selecting samples5 AC- maGes successive dra$s from the sampling population/ "epending on the sampling method5 selected items might be set aside once they are dra$n5 or they might be put bacG into the stream to be dra$n again/ 1n samplin %ithout replacement, an item once selected is set aside and cannot be dra%n a ain / his changes the probabilities of selection for the items remaining in the selection stream/ his is the case in record sampling and in interval sampling $ith top stratum cutoff/ 3n sampling $ith replacement5 ho$ever5 selected items are returned to the stream5 maGing them available for redra$/ As a result5 the probability of redra$ing these items remains the same for successive selections/ So the same item can be dra$n more than once5 as is the case $ith monetary unit sampling/ o limit replacement5 clicG the 'ore tab in the Sample dialog box and then select the +o Repeats checG box/ S Specifying no repeats causes suppression of duplicate sample items so that only one occurrence of each sampled item appears in the output table/ As a result, however, the output table may contain fewer records than the number specified in the Sample command. o compensate for the suppression of any duplicate sample items and to ensure that the full number of re.uired sample items is selected5 you can oversample/ Simply add a fe$ extra records to the sample siMe/ 2versamplin is most often necessary if the no the repeats option is used in con*unction %ith random monetary unit samples / 3n this case5 you can have AC- report the selection order by checGing the Report Selection )rder checG box on the 'ore tab of the Sample command/ his allo$s you to test the re.uired number of items in the order in $hich AC- selected them/ 3f you do not select +o Repeats5 your sample siMe $ill be fulfilled5 but your output sample table might contain duplicate items/ CAA - Computer Assisted Audit ools and echni.ues

Sub "elete"uplicates12 6'sg:ox 1(test(2 "im lRo$s As -ong "im lCount As -ong "im Rng As Range "im Rng+ext As Range 6"im RngRo$ As Range "im lCurrentRo$ As -ong lRo$s F 7H 6Cells1Ro$s/Count5 (A(2/End1xlUp2/Select ?or Each Rng 3n Range1Cells175 725 Cells1lRo$s5 722 Set Rng+ext F Rng/)ffset172 3f Rng+ext/4alue F Rng/4alue hen 6'sg:ox Rng/4alue _ (F first ( _ Rng+ext/4alue _ (F Second ( 6(delete one sell:( Rng/)ffset172/"elete shift:FxlUp 6(delete one ro$:( Rng/)ffset172/EntireRo$/"elete shift:FxlUp

"o #hile Rng+ext/4alue F Rng/4alue Rng/)ffset172/EntireRo$/"elete shift:FxlUp Set Rng+ext F Rng/)ffset172 -oop End 3f +ext Rng End Sub

Vous aimerez peut-être aussi