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 BOBC
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;