|
关键字:
表达式 表达式构造器 代码 EditExpression
说明:
运行期,可以调出系统的表达式编辑器,设计业务表达式。该构造器只检查表达式的语义是否正确,不校验语法(stuido中也是一样的)。
利用构造器设计的表达式,可以通过表达式计算器(TBizExpr)计算、得出结果。
http://bbs.justep.com/forum.php?mod=viewthread&tid=25177
例子:
调用表达式编辑器,为字段Field1的自动填充表达式赋值。
var
lExpression: string;
lDataField: TDataField;
lBizParam : TBizParam ;
lFuncs: TList;
begin
lFuncs:=TList.Create;
try
BizExpr.ExprFunctions.Get(lFuncs,nil,true); //获取当前表达式编辑器可以调用的函数列表
lExpression := SqlDataSet1.BizFieldByName('Field1').AutoFillDef.Expression.Text; //获取默认表达式
if BizUtils.EditExpression(nil, lFuncs, lExpression, nil) then //调出表达式编辑器
begin
SqlDataSet1.BizFieldByName('Field1').AutoFillDef.Expression.Text := lExpression;
end;
finally
lFuncs.Free;
end;
end;
NameSpace: Business.Model
--------------------------------------------------------------------------------
BizUtils = class(System.Object)
public
static function BuildBizFilter(AFilter: string): Boolean;
static function BuildBizFilterEx(AFilter: TBizMultiExpression): Boolean;
static function BuildFilter(AFilter: string; AContext: TContext; ADatabaseURL: string; ASQLText: string; AParams: Business.Data.TParams): Boolean;
static function BuildFilterEx(AFilter: TBizMultiExpression; AContext: TContext; ADatabaseURL: string; ASQLText: string; AParams: Business.Data.TParams): Boolean;
static function BuildSQL(AContext: TContext; ADatabaseURL: string; ASQLText: string; AAllowAgg: Boolean): Boolean;
static function BuildSQLEx(AContext: TContext; ADatabaseURL: string; ASQL: TBizMultiExpression; AAllowAgg: Boolean): Boolean;
static function BuildSQLEx2(AContext: TContext; ADriverName: string; ADatabaseURL: string; ASQL: TBizMultiExpression; AAllowAgg: Boolean): Boolean;
static function EditExpression(AFields: Business.System.TStrings; AFunctions: Business.System.TList; AExprText: string; AExpr: Justep.System.Expr.TExpr): Boolean;
static function EditSpreadDataSet(ADataSet: TSpreadDataSet): Boolean;
static procedure ShowGraphicPropertyDialog(AGraphic: Business.System.TGraphic);
property ModelUtils: TModelUtils;
property ShowSpreadDataSetEditor: to do;
end; |
|