Thursday, October 8, 2009

VBscript vs escript


Recently, I have to write a BS in escript which was
originally written in VB Script. Since Siebel provides a utility to convert the
VB Script to escript but that utility has so many limitations.


Siebel provided utility does only syntactically changes in the
code which is quite helpful when you have huge lines of code to convert. But analyzing
the code is helpful because there can be things which you can do using config,
workflows or BRP.


Limitations of the utility:


Utility does not modify things for the explicit conversions
like Str, CInt, Int if used. Utility does


The differences between Siebel escript and VB Script are as
follows:



 


VB Script


escript


Dates


·        
Uses inbuilt function to convert Date to String and vice versa.
For E.g. DateValue, Str, Format

 

·        
It also uses DateDiff function to calculate the difference of
Days


We need to do scripting for conversion between Date to String
and vice versa.

Also to find the difference of the days you can use a calculated
field or script for finding difference between the Dates.


Function Return Values


Function name = value


Function name = return(value)


Error Hander


Always executed


Only executed if error.

eScript has finally block to destroy objects.


True/False


Integer


Boolean


Parameters


All by ref.


Only Complex Object by ref.


Modulus


To get the reminder, use ‘mod’


%


Integer Division


Use back slash ‘\’ for integer division


For every division, use forward slash ‘/’


Script Structure


Function MyFunction() As String

On Error GoTo ErrorHandler

 

  //comments

  //variable declarations

  //Program statements are here

 

ErrorHandler:

//ErrorHandler label and all following code is
here

 

//Object destroys from (just the) error handler
are moved here

 

End Function


function MyFunction()

{

//comments

//variable declarations

try

{

//Normal code goes here

}

catch (e)

{

//Error code goes here

}

finally

{

//Object destroys go here

}

}

 


 


In escript for
explicit conversion, we can use functions like ToInteger(), ToString().


No comments:

Post a Comment