Beruflich Dokumente
Kultur Dokumente
D!c"ment Identi#icati!n
A"t$!r D!c"ment Name %ersi!n Iss"e Date drs. M.A.T. Linssen MA Siebel eScript standards Final 1.0 05-12-2013
This document aims to set the standard in Siebel eScript programming. t is based on one man-!ear hands-on e"perience #ith eScript itsel$% as #ell as se&eral man-!ears e"perience #ith &arious other programming languages% such as 'AS (% ()')L% (% (**% +'% ,basic% (lipper- plat$orms% such as main$rame .)S/3001% mid$rame% .AS/2001% 3ni" .45-36% Sun Solaris% A 61% 5( .7indo#s 3.1 through 65% )S/21- scripting languages .3ni" shell scripting% 8a&ascript% 9e""% MS-:)S1% and se&eral man-!ears e"perience in s!stem anal!sis% s!stem design% s!stem programming and s!stem test.
&e'ected remar(s
A"t$!r Date S"))esti!n and c!mment
Page 2
Table of Contents
1 INTRODUCTION...............................................................................................................................................5 2 GENERAL CODING GUIDELINES...............................................................................................................6 2.1 NAMING CONVENTION............................................................................................................................. 6 2.2 WHITESPACE........................................................................................................................................... 7 2.2.1 Tabs and spaces......................................................................................................................................7 2.2.2 Whitespace..............................................................................................................................................7 2.2.3 Example 1: tabs and spaces...................................................................................................................7 2.3 COMMENTS............................................................................................................................................. 8 2.3.1 Introductory comment............................................................................................................................8 2.3.2 Comment bloc s......................................................................................................................................8 2.3.3 !ine comments........................................................................................................................................8 2.3." Example 2: comment bloc and line comment......................................................................................8 2.4 DECLARATION......................................................................................................................................... 9 2.".1 Example 3: declaration..........................................................................................................................# 2.5 INITIALISATION AND ASSIGNMENT.......................................................................................................... 10 2.$.1 Initialisation.........................................................................................................................................1% 2.$.2 &ssi'nment............................................................................................................................................1% 2.$.3 (trin' concatenation............................................................................................................................1% 2.$." Example ": initialisation......................................................................................................................1% 2.6 DESTRUCTION....................................................................................................................................... 11 2.).1 Example $: destruction........................................................................................................................11 2.7 STATEMENTS........................................................................................................................................ 12 2.7.1 (tatement bloc ....................................................................................................................................12 2.7.2 I* statement...........................................................................................................................................12 2.7.3 Example ): i* statement........................................................................................................................12 2.7." +,- loop..............................................................................................................................................13 2.7.$ ., / W0I!E and W0I!E loop............................................................................................................13 2.7.) Example ): *or loop..............................................................................................................................13 2.7.7 Example 7: 1hile loop..........................................................................................................................13 2.7.8 (1itch and Case statements.................................................................................................................1"
2.7.8.1 Sw !"# $!%!&'&(!...........................................................................................................................................14 2.7.8.2 C%$& $!%!&'&(!...............................................................................................................................................14
2.7.# Example 8: (1itch statement...............................................................................................................1" 2.8 SCRIPT REDIRECTION............................................................................................................................. 15 2.8.1 Thro1 statement....................................................................................................................................1$ 2.8.2 .ummy do/1hile loop...........................................................................................................................1$ 2.8.3 -eturn...................................................................................................................................................1$ 2.8." Example 1%: return...............................................................................................................................1$ 2.8.$ Example 11: dummy do / 1hile loop 1ith inner loop..........................................................................1) 2.9 )UNCTION CALLING............................................................................................................................... 17 2.#.1 ,b2ects..................................................................................................................................................17 2.#.2 3ariables...............................................................................................................................................17 2.#.3 Control o4er properties........................................................................................................................17 2.#." Example 12: ob2ect and properties......................................................................................................18 2.10 ERROR HANDLING............................................................................................................................... 19 2.1%.1 -eturn.................................................................................................................................................1# 2.1%.2 5reIn4o e6ethod...............................................................................................................................1# 2.1%.3 ,utput e4aluation...............................................................................................................................1# 2.1%." Try / catch...........................................................................................................................................1# 2.1%.$ Example 13: try/catch........................................................................................................................2% 2.1%.) Error lo''in'......................................................................................................................................2% 2.1%.7 7se*ul 'eneric *unctions.....................................................................................................................21 2.11 /USINESS SERVICES............................................................................................................................. 22 2.11.1 6ultiple business ser4ice *ormin' a sin'le lo'ical transaction........................................................22 Project Name
2.9.1.1 O*+&"! ,-.,&-! &$...........................................................................................................................................17
2.11.2 -estorin' arrays and other ob2ects....................................................................................................22 2.12 0NOWN SIE/EL PRODUCT DE)ECTS...................................................................................................... 23 2.13 ILLEGAL STATEMENTS AND ACTIONS....................................................................................................24 2.13.1 8,T, statement.................................................................................................................................2" 2.13.2 WIT0 statement..................................................................................................................................2" 2.13.3 C,9TI97E !&:E! statement...........................................................................................................2" 2.13." +unction recursion.............................................................................................................................2" 2.13.$ 5roperty sets.......................................................................................................................................2" 2.13.) -eturnin' ob2ects................................................................................................................................2" 2.13.7 &rrays 1ith counters o* datatype strin'.............................................................................................2" 2.13.8 8lobal 4ariables.................................................................................................................................2$ 2.13.# +or1ard,nly on instantiated business components..........................................................................2$ 2.13.1% 3anilla (iebel business ser4ices.......................................................................................................2$ 2.14 )UNCTIONS......................................................................................................................................... 26 3 GENERAL QUERY GUIDELINES ..............................................................................................................28 3.1 /USINESS O/1ECTS AND /USINESS COMPONENTS ....................................................................................28 3.1.1 0ierarchical database..........................................................................................................................28 3.2 COMPARISON TO S2L........................................................................................................................... 28 3.2.1 (et3ie16ode........................................................................................................................................28 3.2.2 &cti4ate+ields.......................................................................................................................................28 3.2.3 ClearTo;uery.......................................................................................................................................28 3.2." (et(earch(pec.......................................................................................................................................28 3.2.$ Execute;uery.......................................................................................................................................2# 3.2.) Example 1": (iebel ;uery....................................................................................................................2# 3.3 2UER3ING............................................................................................................................................ 29 3.3.1 ;uery 6ode..........................................................................................................................................2#
Project Name
1 Intr!d"cti!n
This document outlines the guidelines and mandator! standards $or ;< Ser&ice (enter (laims eScripting. t is not intended to be a step b! step instruction manual on ho# to script% but lots o$ hints% tips = tric>s and do?s = dont?s are gi&en. All applies to Siebel @.". t is intended to ensure that an! eScripting per$ormed is accurate% eas! to read and maintainable. n $act% $ollo#ing these guidelines #ill result in per$ectl! clear and legible code. t is a &er! rigid document% #hich should be interpreted that #a!. The general idea is that one standard #ill enable all programmers to loo> at regardless #hich $unctionalit! or technicalit! and that this code #ill loo> AS 4 S )9 4A9 )7; ():A. )ne can imagine the bene$its o$ this. There can be onl! one standard% and that standard #ill ha&e to be used onl!B i$ there are an! reasons to de&iate $rom that standard% such #ill $irst ha&e to be Cudged b! all parties in&ol&edB i$ sensible% it should be Cudged againB i$ practical% it should be Cudged againB i$ not con$licting #ith an! other standard in this document% it should be incorporated into it. $ not% it should be added to this document as a DreCected remar>D% pre&enting others $rom ma>ing the same remar>.
Project Name
Project Name
2.2 *$ites+ace
2.2.1 Ta,s and s+aces
All lines start #ith a tabB in Siebel Tools% tab #idth should be set to three .&ia Tools - )ptions Scripting1. The onl! lines not starting #ith a tab are the $unction descriptor and the start- and end brace. ;o line e&er starts #ith spacesB spaces are to be used onl! at the end o$ a line or sentence- tabs are be a&oided at this point because o$ possible tab-#idth di$$erences. Spacing and tabbing should be nice% in generalB code should read li>e a boo>% or rather% li>e a poemB #hitespace must be used to >eep code legible% Euiet% peace$ul% and ma!be e&en a little entertainingB programming and maintaining code is not onl! a di$$icult Cob% but a prett! tiresome one as #ell. )&er&ie# is easil! lost i$ Dthe code loo>s li>e a messD. A&er! &ariable% identi$ier and condition should be separated b! a space% i$ applicable .not #ith auto-increment/-decrement% assignment operators1B it doesn?t matter $or the compiler but it does to the e!eG
2.2.2 *$ites+ace
7heree&er possible% use plent! o$ #hitespace. There #ill be moments o$ running into and out o$ the Siebel 1@ H' limit $or single $unctions% at #hich the best thing to do is to split the #hole $unction in t#o parts% i$ possible. :ouble line $eeds ma>e !our code breathe% and #ill onl! cost !ou 2 to @ b!tes in general.
Project Name
2.3 C!mments
There are se&eral #a!s o$ indicating a commentB 11 // at the beginning o$ a line #ill ma>e that #hole line a comment21 // at some place in a line #ill ma>e the rest o$ that line a comment31 /I #ill start a comment and end it #hen I/ is encounteredB this is the onl! #a! to ma>e multipleline comments% also >no#n as comment bloc>s.
2.3.3
ine c!mments
Line comments indicating ends o$ i$-statements% do-% #hile- and $or-loops should start one space a$ter the brace% and repeat the #hole statement .unless legibilit! reEuires other#ise1% to be ended b! another space and the #ord DendD. This insures consisitenc! throughout the #hole script% although changes in the statement itsel$ must be re$lected in the commentG
true<:)5
Project Name
2.0 Declarati!n
+ariables should be declared at the start o$ a $unction% a$ter the $irst comment bloc>. The! should be declared alphabeticall!% because that?s ho# the debugger #ill sho# them. ;ot binar! alphabetic% but DCust alphabeticDB the debugger is case-insensiti&eG The $irst &ariables to sho# in the debugger are the ones passed as parameters to the $unctionB as the!?ll all be obCects an!#a!% don?t #orr! about the alphabetic order o$ themB their &alues are o$ no use in the debugger. These arguments #ill be sho#n in re&erse orderB the last one $irst% then the second to last% etcetera. A comment bloc> should precede the &ariables declaration% statingB +ariables declaration :eclaring &ariables at the uppermost le&el a&oids scope problems% destruction problems% and optimiFation problemsB one single declaration bloc> at the uppermost le&el enables one single initialisation bloc>% and one single destruction bloc>. )ne line per &ariableG t is $orbidden to declare more than one &ariable in a single line. $ a &ariable is used onl! once% and i$ it?s to be e"pected that that #ill remain the case% it is unnecessar! and $orbidden to use a &ariable% unless the alternati&e .a concatenation or computation o$ other &ariables1 is too comple". )n the other hand% i$ !ou use a &alue more than once% it should be made a constantB declare it as a &ariable.
/* * =aria31e */ var var var var var var var var var var var var
dec1aration
i5 45 oINS&1aim 8&5 oINS&1aim 8O5 oInput5 oInterfaceService5 oOutput5 Output5 Or0ani>ation5 Po1ic28ranch5 ?ecord@ound5 ?o1e5
Project Name
2.5.2 Assi)nment
(onditional operators are $orbiddenG An i$ statement must be used to assign &ariables a &alue that is dependent on a condition.
/* * =aria31e */
initia1i ation
oInput 6 $he!pp1ication()#Ne+Propert2Set()5 oOutput 6 $he!pp1ication()#Ne+Propert2Set()5 oInterfaceService 6 $he!pp1ication()#GetService(:S&& Interface:)5 Ae1come 6 :Be11o : C D erName C :, ho+ are 2ouE:5
Project Name
2.1 Destr"cti!n
To destro! an obCect in Siebel eScript% set it to null% or set the &ariable containing it to another &alue. The best practice is to destro! obCects in the order opposite to the order o$ creation. .Euote $rom Siebel 'oo>shel$ )bC nt.pd$1 Siebel eScript >no#s implicit obCect allocation% and e"plicit obCect deallocationB obCects are al#a!s allocated to memor! .and passed b! re$erence1% and ha&e to be deallocated in order to $ree that same memor!. Although man! Siebel +anilla $unctions do lea> themsel&es% it is pro&en that Dre&erse memor! deallocationD% i.e. deallocation obCects in the re&erse order !ou assigned / initialised them% does help to reduce memor! usage. The onl! possible #a! to achie&e total memor! deallocation is to close the Siebel application .sicG1. :estruction must occurr Cust be$ore the return. A comment bloc> should precede the &ariables initialisation% statingB 9eturnB clean up data associated #ith obCects to deallocate them $rom memor! )nl! obCects ma! be destro!ed% it is useless and con$using to set normal &ariables .noncomposite datat!pes1 to null. Appropriate line spacing should be usedB tr! to distinguish logical bloc>s #hen deallocating.
/* * ?eturn" c1ean up data a */ oINS&1aim 8O 6 nu115 oINS&1aim 8& 6 nu115 oInterfaceService 6 nu115 oOutput 6 nu115 oInput 6 nu115 7 return (Output)5
Project Name
2.2 Statements
Apart $rom the pre&iousl! mentioned la!out rules and guidelines% there?s a general la!out ruleB ma>e code legibleG
2.2.2 I# statement
The i$ statement must be outlined as $ollo#sB one space a$ter the #ord i$% round brac>ets $or the condition and braces $or the statement bloc>. ;o spaces should be used a$ter a begin round brac>et% .% and be$ore an end-round brac>et% 1. Logical operators .A;:% ==% and )9% LL1 must start at a ne# line. Appropriate use o$ space must be used to line up the &arious lines comprising the i$ statement. 3se o$ brac>ets should be limited% there?s no need to use braces $or e&er! part o$ a condition% unless it is absolutel! necessar!. :on?t $orget that A;: operators ta>e precedence o&er )9 operators. 7hene&er booleans are to be e&aluated in an i$ statement% the! must not be compared to true or $alse% but to the boolean itsel$B the logical ;)T operator% G% must be used to compare it to $alse
if ((!ttri3uteFiG 66 :!ttri3ute name6&ate0or2 t2pe6 tr: HH ?o1e#toDpper&a e() 66 :='?I'J'?INGN'M'?:) KK (!ttri3uteFiG 66 :'ntit2 : HH (?o1e#toDpper&a e() 66 :8'S$DD?)'?: KK ?o1e#toDpper&a e() 66 :G'$DIG': KK ?o1e#toDpper&a e() 66 :$'G'NP!?$IL: KK ?o1e#toDpper&a e() 66 :='?I'J'?)':))) { )ataFdGF,G 6 i5 if (<SkipFiG) { )ataFdGF-G 6 o8u &omp#Get@ie1d=a1ue(@ie1dFiG))5 7 e1 e { )ataFdGF-G 6 ::5 7 7
Project Name
for (i 6 ,, d 6 ,5 i M )ata#1en0th5 dCC) { i 6 )ataFdGF,G5 oS&&Propert2SetF&hi1dFiGG 6 $he!pp1ication()#Ne+Propert2Set()5 if (!ttri3uteFiG 66 ::) { oS&&Propert2SetF&hi1dFiGG#Set$2pe(@ie1dFiG)5 7 ### ### 7 // for (i 6 ,, d 6 ,5 i M )ata#1en0th5 dCC) end
+hi1e (?ecord@ound) { Interface#&1aimId 6 oINS&1aim 8&#Get@ie1d=a1ue(:Id:)5 S&&%o0'rror (Interface)5 oInput#SetPropert2(:Id:, Interface#&1aimId)5 oInterfaceService#InvokeMethod(:S&&Band1eInterface?eNue t:, oInput, oOutput)5 ### 7 // +hi1e (?ecord@ound) end
Project Name
A s#itch statement is a conditional statement% #hich is in $act an i$ - else i$ statement #here one &ariable can be compared to se&eral conditions. t must be outlined as $ollo#sB one space a$ter the #ord s#itch% round brac>ets $or the statement and braces $or the statement bloc>. ;o spaces should be used a$ter the begin round brac>et% .% and be$ore the end-round brac>et% 1. A s#itch consists o$ at least one case and one de$ault .at the end o$ the s#itch statement1. All cases and the de$ault end #ith a colon% B% directl! a$ter the last character. Case statement
2.2.6.2
A&er! case must end #ith a brea>G The brea> belongs to the statement bloc> and must be indented accordingl!. $ there is no brea>% e"ecution #ill continue #ith the ne"t statement bloc>% disregarding the corresponding caseG A case statement must be outlined as $ollo#sB one space a$ter the #ord case% single or double Euotes $or the &alue% a colon directl! $ollo#ing the &alue% and braces $or the statement bloc>.
/* * =aria31e e9ecution" */
3een ca11ed
+itch (Interface#Interface) { ca e ;S&& Interface &1aim;" { Interface#@unction 6 :S&& Interface &1aim:5 Interface#8u O34Name 6 :INS &1aim :5 Interface#8u &ompName 6 :INS &1aim :5 Interface#?eNue t 6 true5 3reak5 7 defau1t" { Output 6 :)e interfaceOn: C Interface#Interface C :Oni niet 0edefinieerd in : C Interface#&urrent@unction C $he!pp1ication()#GetSharedG1o3a1(:S&&Support:)5 Output 6 $he!pp1ication()#GetSharedG1o3a1(:S&&'rror:) C Output5 3reak5 7 7 // +itch (Interface#Interface) end
Project Name
2.6.3 &et"rn
t is technicall! possible to ha&e as man! returns as possible in a script. A return #ill directl! end a script% lea&ing all obCects and &ariables as the! are% unless there is a tr!-catch-$inall! construction% #here the $inall! #ill be e"ecuted $irst% but !ou?ll notice that a little $urther in this document it is e"plained #h! $inall! clauses are useless and thus $orbidden. Multiple returns are $orbiddenB e&er! $unction must contain at minimum one and at ma"imum one return. As there is al#a!s something to return% this poses no problems at all. t must be outlined as $ollo#sB one space a$ter the #ord return% and round brac>ets $or the return &alue% #hich must al#a!s be )utput. ;o spaces should be used a$ter the begin round brac>et% .% and be$ore the end-round brac>et% 1.
oINS&1aim 8O 6 nu115 oINS&1aim 8& 6 nu115 oService 6 nu115 oOutput 6 nu115 oInput 6 nu115 7 return (Output)5
Project Name
do
{ ### +hi1e (?ecord@ound) { ### if (oINS&1aim 8&#Get@ie1d=a1ue(:Id:) 66 nu11) // 4u t kiddin0< { StopPro0ram 6 true5 3reak5 7 ### ?ecord@ound 6 oINS&1aim 8&#Ne9t?ecord()5 7 // +hi1e (?ecord@ound) end if (StopPro0ram) { 3reak5 7 for (i 6 ,5 i M ?ecord#1en0th5 iCC) { ### 7 // for (i 6 ,5 i M ?ecord#1en0th5 iCC) end 7 +hi1e (fa1 e) // dumm2 do ### +hi1e 1oop end
Project Name
2.7.1 3,'ects
)bCects are passed b! re$erence. nstead o$ cop!ing &alues and passing them to $unctions% onl! a memor! address is passed #here the obCect resides. This signi$icantl! speeds up e"ecution and reduces memor! usageG (hanges to obCects at an! place appl! to the obCect itsel$% unless a cop! is e"plicitl! made. This is a great pro% and might be the greatest con as #ell. 3,'ect +r!+erties
2.7.1.1
There is one single rule that eases the pain o$ handling obCectsB as long as obCect properties aren?t obCects themsel$% there?s absolutel! no need to touch obCect properties other than reading them and adding them. n $act% it?s #ise not to destro! an! obCect properties at all unless the end o$ the $unction is reached #here the obCect #as created. t might be ine&itable to assign obCects to obCects% since it is best to pass one obCect onl! to $unctionsB in $act% in the ideal situation% all $unctions onl! ta>e one argument #hich is an obCect% but this might be to much arithmetic e&en $or the ad&anced programmer. )bCects can become Euite large% #ith all the properties added to them. 9emember that this can ne&er be a con% since these properties normall! #ould ha&e e"isted an!#a! as normal &ariables% at least once or t#iceG (ollecting all &ariables o$ a module in one obCects is a great ad&antage% as the obCect can be used $or logging purposes in case o$ erros. At this point the greatest disad&antage is $ormed b! Siebel #hich doesn?t allo# table colums to e"ceed 1@ H'G +ariables that #ill e&entuall! ha&e to be added to $unction calls% because o$ $unctional and or technical demands% can simpl! be added to the obCect at some place and retrie&ed $rom the obCect at another placeB there is no need to adCust the $unction call or the $unction arguments. The debugger #on?t sho# obCect properties% neither $rom DrealD obCects nor $rom arra!s. This has got nothing to do #ith pro?s or con?s o$ obCects% this Cust points to a &er! slopp! and barel! usable debugger in Siebel. $ !ou #ant to see all properties o$ an obCect at an! point% Cust use the generic dump $unction in combination #ith the log $unction or #rite $unctionG
2.7.2 %aria,les
Since all &alues can be retrie&ed through the input parameters passed to $unctions% the &alue returned can be used $or errorhandling. )$ course errorhandling can be done &ia obCects as #ell% but anal!Fing the return o$ a $unction is classical and practical. )bCects and their properties #ill be used in errorhandling an!#a!% and in s!stem programming is it ine&itable that error.s1 #ill turn up as obCect properties at some point in time.
Project Name
properties in use at a certain point during script e"ecution% use the generic log .to database or $ile1 and / or dump $unction made $or ;< Ser&ice (enter (laims. )$ course% a clear and up-to-date detailed technical design tells !ou #here to $ind e&er!thing% but the code is leading #hen it comes to usage o$ obCects / &ariables.
tr2 { do
{ initia1i ation
/* * =aria31e */
@raud 6 ne+ O34ect()5 @raud#@unction 6 :S&& @raud &heck:5 @raud#&urrent@unction 6 :&heck@raud:5 @raud#?o+Id 6 oInput#GetPropert2(:Id:)5 @raud#&1aimId 6 oInput#GetPropert2(:&1aimId:)5 @raud#@raud$e9t 6 oInput#GetPropert2(:@raud $e9t:)5 @raud#'rror 6 ::5 @raud#@raudStatu 6 ::5 @raud#Geen8e tuurder 6 fa1 e5 @raud#Puick?oute 6 fa1 e5 @raud#?ea i0n 6 fa1 e5 @raud#Speciaa1Onder>oek 6 fa1 e5 @raud#Specia1eSchade 6 fa1 e5 @raud#=!8evoe0d@1a0 6 fa1 e5 ### /* * &heck c1aim data */ if (<&heck&1aim)ata(@raud)) { 3reak5 7
Project Name
2.10.1 &et"rn
Functions return &aluesB in all cases% this &alue #ill be the &ariable )utput. $ an error occurred% this &ariable #ill contain an error message #hich #ill be concatenated #ith the global &ariable S((Support% #hich is a sentence redirecting the user to the compan!?s support des>. To dri&e the t!pes o$ output it must then be preceded b! another global &ariable% o$ #hich there are threeB S((Arror% S((7arning and S(( n$o. These #ill determine the message bo" title and icon.
2.10.2 8reInv!(eMet$!d
'! de$ault% each 5re n&o>e Method must assign (ontinue)peration .in $act% the &alue 11 to the &ariable )utput% #hich is to be returned. Failure to in&o>e the method #ith an appropriate method name #ill result in a &anilla Siebel error% #hich ma! onl! occur during de&elopment. A s#itch must e&aluate the &arious Method;ames passed% and assign (ancel)peration .mostl!1 or (ontinue)peration be$ore the brea> in each underl!ing case. Aach business ser&ice must return the propert! S(()utput in the propert! set o)utputB this string must be eEual to the global &ariable S(()utput% other#ise the business ser&ice has $ailed e"ecution and $urther e"ecution must end. The propert! S(()utput is set to the &alue returned b! the main $unction. 'usiness ser&ices e"ecuted on the ser&er% called b! in&o>ing a ser&er reEuest that e"ecutes a #or>$lo#% must also return this &alueB all #or>$lo#s e"ecuting business ser&ices must ha&e at least one output argument% #ith the same name% that passes on this output argument to the calling $unction% #hich has to e&aluate it.
Project Name
e"actl! the same place% #ithout the clause itsel$B seEuential script e"ecution #ill al#a!s continue a$ter the catchG The tr!-catch statement must be outlined as $ollo#sB a line$eed a$ter the #ords tr! and catch and braces $or the code bloc>. Appropriate indenting must be used. For the catch% the &ariable caught should al#a!s be e"ception% #hich must be enclosed in round brac>ets% #ith a space bet#een catch and e"ception. ;o spaces should be used a$ter the begin round brac>et% .% and be$ore the end-round brac>et% 1. The tr! statement must start a$ter the declaration bloc> and be$ore the initialisation bloc>B that is the $irst point #here errors can ocur. n the catch% the output )utput must be set to the most li>el! error message. :ependent on the place o$ e"ecution .client or ser&er1 this error #ill be .directl!1 sho#n to the user% but e&entuall!% at the end o$ the #hole transaction% it #ill ha&e to be sho#n to the user% and #ritten to the database error log% as #ell as to a $ile in the temporar! 7indo#s director! o$ the client?s machine. $ the e"ecution resides on the ser&er as a #hole .e.g. a batch process1 it must onl! be #ritten to the error log. The catch must al#a!s be accompanied b! a comment bloc> e"plaining the possible error.s1 leading to the e"ception. All signi$icant $unction &ariables must be stored to the obCect in the catch.
tr2 { ### 7 catch (e9ception) { /* * I rea112 don;t kno+ +hat cou1d 0o +ron0 here, 3ut +ho kno+ E * !n2+a2, et Output to S&&'rror */ Interface#d 6 d5 Interface#'9ception 6 e9ception5 Interface#i 6 i5 Interface#ii 6 ii5 Interface#4 6 45 Output 6 :'r i een on3ekende fout op0etreden in functie : C Interface#&urrent@unction C $he!pp1ication()#GetSharedG1o3a1(:S&&Support:)5 Output 6 $he!pp1ication()#GetSharedG1o3a1(:S&&'rror:) C Output5 7
Project Name
Project Name
Project Name
Project Name
Project Name
2.13.10
+anilla Siebel business ser&ices can be use$ul% and can be uselessB the! also can be de$ecti&e. The business ser&ices RAA 6ML 7rite to FileD and RAA 6ML 9ead $rom FileS must not be usedB S((7riteFile and S((9eadFile must be usedB the! gi&e $ull control o&er director!- and $ileaccessibilit!% and could o$$er possibilities to o&ercome the large string-bug in S ebel% #hich #ill cause problems i$ strings are larger than 50H'. 'oth $unctions are placed on the Application le&el% ta>e one obCect as input and return Rthe usualS output.
Project Name
2.10 F"ncti!ns
Hno#ing all this% it is &er! eas! to build a $unctionB
t starts #ith a statement bloc>% describing the $unctionThen comes the declarations bloc>% naming all the &ariables;e"t is the tr! clause% #hich starts the errorhandlingThe dumm! do #hile enables script redirectionThe initialisation bloc> $ollo#s% initialiFing &ariables as much as possible% #ithout o&erinitialiFing themA"ecution begins% and ends% a&oiding all prohibited and de$ecti&e statementsThe dumm! do #hile endsThe tr! ends% and the catch starts% #here the e"ception and as much as &ariables as possible are set as properties to the input obCect)bCect deallocation ta>es place through &ariables destructionThe $unction returns the output )utput.
)n the $ollo#ing page there?s an e"ample o$ a s>eleton $unction% to be used $or creating ne# $unctions in Siebel.
Project Name
function M2@unction(M2O34ect) { /* ******************************************************************************** * @unction * * !uthor" * * )ate*+ritten" * ******************************************************************************** * Input" * * M2O34ect Generic ### o34ect * * * * Output" * * Output nothin0, rea112 * ******************************************************************************** */ /* * =aria31e */ var M2O34ect5 var Output5 /* * =aria31e */ tr2 { do initia1i ation dec1aration
/* * Main" add 2our comment here */ ### (add 2our code here) 7 +hi1e (fa1 e) // dumm2 do ### +hi1e end 7 catch (e9ception) { M2O34ect#'9ception 6 e9ception5 Output 6 :'r i een on3ekende fout op0etreden in functie"On: C M2O34ect#&urrent@unction C $he!pp1ication()#GetSharedG1o3a1(:S&&Support:)5 Output 6 $he!pp1ication()#GetSharedG1o3a1(:S&&'rror:) C Output5 7 /* * ?eturn" c1ean up data a */ M2O34ect 6 nu115 7 return (Output)5 ociated +ith o34ect to dea11ocate them from memor2
Project Name
3.2 C!m+aris!n t! S=
Siebel interacts #ith the database &ia its Euer!-statementsB this means that the! can be literall! translated to .parts o$1 S,L-statements% #hich results in a logical orderB
3.2.1 Set%ie5M!de
7hen instantiating the primar! business component% set the desired &ie# modeB donTt $orget this or !ouTll create m!sterious problems $or !oursel$ and !our $ello# de&elopersB the &ie# mode gi&es user-restricted access to tables and &ie#s. $ the current &ie#mode must be stored% use <et+ie#Mode. The general &ie# mode used is All+ie#B this #ill gi&e !ou &isibilit! across all organisations. n special cases% the &ie# mode )rganiFation+ie# can be used% but there has to be a &er! good reason to do thisG
3.2.2 ActivateFields
Acti&ating $ields means adding them to the S,L-select clause. Fields that are ForceActi&e on the business component or ha&e their Lin> Speci$ication set to T93A% Siebel s!stem $ields such as (reated% 3pdated% d and Siebel $ields that are &isible at the moment .becuas the!Tre on the acti&e applet1 donTt need to be acti&ated.
3.2.3 ClearT!="er/
(learTo,uer! is used to clear the current searchspec and sortspec on the business component. $ the current Searchspec or Searche"pression must be stored% use <etSearchSpec or <etSearchA"pr. (learing a Euer! means empt!ing the current S,L #here-clause.
3.2.0 SetSearc$S+ec
SetSearchSpec is used to set .a part o$1 the #here-clause o$ the S,L-Euer!
Project Name
3.2.5 -.ec"te="er/
A"ecute,uer! o$$ers the S,L-statement to the database and returns a recordset
oINS&1aim 8&#Set=ie+Mode(!11=ie+)5 oINS&1aim oINS&1aim oINS&1aim oINS&1aim 8&#!ctivate@ie1d(:%o )ate:)5 8&#!ctivate@ie1d(:S&& 8e chadi0de Iaak $2pe:)5 8&#!ctivate@ie1d(:S&& 8ranche &ode:)5 8&#!ctivate@ie1d(:S&& )irect 8ehande1en @1a0:)5
oINS&1aim 8&#&1ear$oPuer2()5 oINS&1aim 8&#SetSearchSpec(:Id:, @raud#&1aimId)5 oINS&1aim 8&#'9ecutePuer2()5 ?ecord@ound 6 oINS&1aim 8&#@ir t?ecord()5 if (?ecord@ound) { ### 7
3.3 ="er/in)
3.3.1 ="er/ M!de
$ possible% use For#ard)nl!% since this #ill signi$icantl! speed up e"ecution. For#ard)nl! is possible i$ !ou don?t tra&el bac> .e.g. b! using First9ecord.1% 5re&ious9ecord.1% FirstSelected.11 through the recordset #ithout reEuer!ing the business component. Siebel #ill hold the entire recordset in memor!% occup!ing a considerable amount o$ memor! and maintaining a large rollbac> segment% causing a high drain on per$ormance. :onTt .this has been mentioned earlier1 use For#ard)nl! on alread! acti&e business componentsG $ the boo>shel$ is right .#hich it isnTt1% For#ard)nl! should not be used at all because the onl! #a! to instantiate a business component is to reuse an e"isitng one or recreate one i$ it doesnTt alread! e"ists- o$ course% thereTs no telling #hich situation is at hand since thereTs onl! one command to instantiate a business component.
Project Name