100% found this document useful (1 vote)
2K views3 pages

Bods Scripting

Scripts in BODS are used to call functions, assign values to variables, write expressions, create custom functions, and perform custom transformations. Key elements of scripts include variables, functions, if/else statements, loops, and assignment statements. Variables start with $, comments with #, and functions are called within (). Scripts can be written and executed in the Script Object or Smart Editor.

Uploaded by

Lakshmi P
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
2K views3 pages

Bods Scripting

Scripts in BODS are used to call functions, assign values to variables, write expressions, create custom functions, and perform custom transformations. Key elements of scripts include variables, functions, if/else statements, loops, and assignment statements. Variables start with $, comments with #, and functions are called within (). Scripts can be written and executed in the Script Object or Smart Editor.

Uploaded by

Lakshmi P
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

 Scripts are basically used to call functions and assign values to variables in a work flow.

 It enables to pass/derive variable values

 To write expressions(ie. case validation )

 To create custom bods functions

 Custom transformation in BODS

 For example, you can use the script to determine the most recent update time for a table,file
names,File locations etc and then assign that value to a variable. You can then assign the
variable to a parameter that passes into a data flow,format,datastore,table names etc.

A script can contain the following statements:

 Begin End

 All BODS Function calls(sql functions are used frequently)

 All BODS variables

 If else statements

 Try catch

 While statements

 Assignment statements

 Operators

 The basic rules for the syntax of the script are as follows(Special characters used in the language
):

 Each line ends with a semicolon (;). end of each bods statement

 Variable names start with a dollar sign ($). to define variables(to replace the values)

 Comments start with a pound sign (#) which helps you to write comments.This will not be taken
as a part of logic.

 {} flower brackets: copies varaible value as a character $G_NextMonth = {$G_Month}('5')+1

 [] square brackets: if you want to take the value of variable,it copies variable value as a integer

$G_Month = date_part(sysdate,month);$G_NextMonth = [$G_Month]+1;


 ()open brackets: To call functions,every function should open/closed bracket.the parameters
expected should be with in this bracket.

 || (pipe): for concatenation

 !(esclamatory) not (!= not equal to,<> not equal to )

 , comma : parameter seperator

 String values are enclosed in single quotation marks ('). parameter passing

date_part() date_part('sysdate','mm');

 *\? (wild card characters)

 Escape Characters: if any of the special character is a art of value i.e. you want skip the value
then go for escape characters

print('my neighbour's house') neighbour's ' is part of the text , for that we have to use backward slash \
to skip the value

print ('my neighbour\'s house') ;

Place you can write scripting language

 Script Object

 Smart Editor(To write a function it opens a window which allows to write code)

Ex We are running a fact table,it should whether the master table data is successfully run or not,else you
successfully execute the job

 Logic to define event based job execution.

$G_MDExecutionstatus = SQL('DS_YYY','select status from AL_History where job_id=(select max(job_id)


from AL_history where job_name='aaa' and jobstartdate=sysdate)

if(($G_mdexecutionstatus)=1)

begin

print('Master data is successfully loaded, the job is started');

end

else

exec('C:\windows\cmd.exe','D:\md.fact');
print('Started MD job');

raise_exception;

You might also like