Siebel(escript)的學習:
1.Siebel的數據類型
Primitive(原始的)---Number,Integer,Hexadecimal(十六進制),Octal(八進制),Floating Point(浮點),Decimal(十進制),Scientific(系統的),Boolean, String
Composite(復合的)---Object,Array,
Special(特殊的)----Undefined(未定義的), Null,NaN(非數值)
2. typeof 方法
typeof variable or typeof(variable)
返回值為:"undefined","boolean","string","object","number","function",or"buffer"
3. Refresh Record Methods
刷新Applet的記錄
var oBs=TheApplication().GetService("FINS Teller UI Navigation").
oBs.InvokeMethod("RefreshCurrentApplet",Inputs,Outputs);
/*如果input的參數中有設置Refresh All為Y,則刷新當前View所在的所有Applet*/
BC有兩個Method:
BusComp.invokeMethod("RefreshRecord") 刷新當前記錄
BusComp.invokeMehtod("RefreshBusComp") 刷新當前查詢記錄
4.TheApplication().Trace Method
TheApplication().TraceOn(filename,type,selection)
Filename 為日志文件,絕對路徑
Type 包括Allocation和SQL
1.Allocation.Traces allocations and deallocations of Siebel objects. This option is useful if you suspect memory leaks in your code.
2.SQL.Traces SQL statements generated by the Siebel application.
Selection 一般我們都用All就可以了
eg: TheApplication().TraceOn("D:\\siebel_debug\\trace.txt","Allocation","All");
5.配置MVL注意點
配置MVL時需要將use primary join 打勾,不然會導致生成N+1條SQL語句的問題.
MVL.use primary join的作用:
use primary join沒有打勾,會把每條關聯數據都查詢出來.
use primary join 有打勾,只會把主關聯數據查詢出來.
6.About Get BO\BC
About Get BO
1.TheApplication().ActiveBusObject();
returns the business object for the business component of the active applet
2.this.BusObject();
returns the business object for the business component of the applet.
3.TheApplication().GetBusObject("BO NAME");
instantiates and returns a new instance of the argument specified business object
---------------------------------------------------------------------------------------------
About Get BC
1.TheApplication().ActiveBusComp();
returns the business component associated with the active applet.
2.this.BusComp();
returns the business component of the applet.
Eg: this.BusComp().GetFieldValue(“Id”); //use it to get current record id
3.boXXX.GetBusComp("BC NAME");
instantiates and returns a new instance of the argument specified business component
7.BC Operation
with(oBcName){
ClearToQuery();
SetViewMode(AllView);//ViewMode,一般常用的為 Organization Catelog 等
ActivateField("Status");
SetSearchSpec("Id", sOrdId);// or SetSearchExpr(sSearch);
//特別注意 SetSearchSpec 和 SetSearchExpr 交替使用是會覆蓋查詢條件的情況,自己測試
ExecuteQuery(ForwardOnly);
}
//DeleteRecord 不需要 NextRecord
8.在 escript 中使用 PickList
在腳本中對具有 PickList 的 Field 賦值時,不要直接使用 SetFieldValue 對 field 直接賦值,需要使用 Pick 方法
錯誤的賦值方式:
BC.SetFieldValue("fieldname", "value"),
正確的賦值方式:
with(oBcCA){
var oBCPick = GetPicklistBusComp("State");
with (oBCPick)
{
ClearToQuery();
SetSearchSpec("Value", "CA");
ExecuteQuery(ForwardOnly);
I f(FirstRecord())
Pick();
}//end with(oBCPick)
oBCPick = null;
}//end with(oBcCA)
9.eScript 中 Split 方法的使用
循環使用 Split 方法會引起內存泄漏,在使用一次后,請及時 destory 對象。如下所示:
while(bHasRecord)
{
sSpiltText = GetSplitText();
var aSplit = sSplitText.Split(“,”);
//TODO Business
aSplit = null;
}//end while
10.對於導入導出的代碼的寫法
//打開一個文件選擇對話框
var cdl = new ActiveXObject( "MsComDlg.CommonDialog" );
cdl.MaxFileSize = 256 ;
cdl.DialogTitle = "Select Data File" ;
cdl.Filter="Excel Files(*.xls)|*.xls|Batch Files(*.csv)|*.csv|Text Files(*.txt)|*.txt|Other Files(*.*)|*.*";
cdl.ShowOpen();
var sFileName = cdl.FileName;
//得到 Excel 中的數據
var ExcelApp = new ActiveXObject("Excel.Application");
var ExcelBook = ExcelApp.Workbooks.Open(sFileName);
var ExcelSheet = ExcelBook.WorkSheets("Sheet1");
var sTemp = ExcelSheet.Cells(1,1).Value;
eScript腳本
1.主要使用在:Application Applet BC BS(BS對象就是腳本組成,是對一系列腳本的封裝)
eScript語言主要在Browser Script 和Server Script.
Applet 腳本主要體現在各個按鈕上.Applet的各個按鈕主要定義在Control上.
Browser Script主要運行在瀏覽器端,Server Script主要運行在服務器端.
執行順序:優先執行Browser 端的腳本-->Server端的腳本,腳本不只是寫在Browser 端,Server端的配置,還有信號只是針對業務需求很少用到.
2.業務服務(BS)
就是定義一個名稱,然后指定一個Project,Class一般是默認的.除了特殊的,比如說接口。
業務服務結構:
主要就是Method,里面包含一系列的方法,配在UP里面.
Applet Browser Script()加載頁面就已經執行了.
BS:Method定義一系列方法的集合.BS Server 腳本.
3.控制按鈕明暗的兩種方式:
1)Server端配置按鈕明暗的:PreCanInvoke() 寫腳本配置
2)UP中控制:CanInvokeMethodUP:方法名 也可控制按鈕的明暗的. Ture 或者False 或一系列的運算.
3)針對控制按鈕明暗來說優先執行順序:UP>BroswerScript.邏輯腳本可以寫在:Up>Browser腳本>Server腳本
4)了解兩個返回操作的代碼ReturnCancelOperation與 RerurnContinueOperation的區別.
4.Applet腳本的寫腳本的位置:Browser eScript(Applet_PreInvokeMethod ,Applet_InvokeMethod), Server eScript(PreInvokeMethod,InvokeMethod,PreCanInvokeMethod)
BC端:Broswer Script不用寫腳本,Server Script需要寫腳本. 服務器端對應的是column,寫腳本的位置:BusComp_PreSetFieldValue ,BusComp_SetFieldValue.
5.Siebel 腳本語法規則:
1)eScript腳本語法定義規則
var aGood;
對象變量:Applet、BO、 BC、 View 、Screen、 Application
//獲取BO對象 var oBo=TheApplication().getBusObject("BO名稱");
//獲取BC對象 var oBs=TheApplication().GetBusService("業務服務的名稱");
//獲取BC對象 var oBc=oBo.GetBusComp("BC名稱");
fucntion方法定義一個名稱
function aGount(Inputs,Outputs){
try{
}catch(e){
}finally {
}
}
2)BC對象下常用的方法.
with(oBc){
//1.設置數據視圖權限
SetViewMode(AllView);
ClearToQuery();
//2.激活字段(相當於把某個字段查出來了.)
ActiveField("字段名稱")
//3.設置查詢條件
SetSearchSpec("Product Type Code","產品");
var sStr="[字段1]=值 and [字段2]<>值 or [字段3]=值";
setSearchExpr(sStr);
//4.執行查詢
ExecuteQuery(ForwardOnly);
//5.獲取結果集並判斷結果
result=FirstRecord();//接收第一條記錄
//6.判斷
if(result){
//修改字段值
SetFieldValue("字段Name","要設的值");
//獲取字段值
GetFieldValue("字段名稱");//返回的是String類型
//7.保存提交
WriteRecord("保存名稱");
}
}
6.BC代碼的編寫順序:
1).設置數據視圖權限
2).清除查詢
3).激活字段(相當於把某個字段查出來)
4).設置查詢條件
5).執行查詢
6).獲取結果集並判斷結果
7).保存提交