Siebel学习笔记
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).保存提交
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律