要修改这几个地方
procedure TSimpleSQLFilterEditor.Init(ADataSet: TBizDataSet;
AExprItem: TSimpleSQLFilterExprItem);
begin
FBooleanOpr.Items.Clear;
FBooleanOpr.Items.Add('');
FBooleanOpr.Items.Add('AND');
FBooleanOpr.Items.Add('OR');
FBooleanOpr.ItemIndex := 0;
FRelationOpr.Items.Clear;
FRelationOpr.Items.Add('=');
FRelationOpr.Items.Add('>');
FRelationOpr.Items.Add('<');
FRelationOpr.Items.Add('>=');
FRelationOpr.Items.Add('<=');
FRelationOpr.Items.Add('<>');
FRelationOpr.Items.Add('好像'); //这里
FRelationOpr.Items.Add('NOT LIKE');
FRelationOpr.Items.Add('IN');
FRelationOpr.Items.Add('NOT IN');
FRelationOpr.Items.Add('BETWEEN');
FRelationOpr.Items.Add('NOT BETWEEN');
FRelationOpr.Items.Add('IS NULL');
FRelationOpr.Items.Add('IS NOT NULL');
FRelationOpr.ItemIndex := 0;
if Builder <> nil then
FLeftEdit.Items.Assign(Builder.BizFields);
ExprItemToEditor(ADataSet, AExprItem);
end;
procedure TSimpleSQLFilterEditor.ExprItemToEditor(ADataSet: TBizDataSet;
AExprItem: TSimpleSQLFilterExprItem);
begin
if AExprItem <> nil then
begin
if AExprItem.RelationOpr = 'LIKE' THEN AExprItem.RelationOpr := '好像'; //这里
FLeftEdit.ItemIndex := FLeftEdit.Items.IndexOf(
FieldToDisplayName(ADataSet, AExprItem.FieldName));
FBooleanOpr.ItemIndex := FBooleanOpr.Items.IndexOf(AExprItem.BooleanOpr);
FRelationOpr.ItemIndex := FRelationOpr.Items.IndexOf(AExprItem.RelationOpr);
UpdateRelation;
LoadFieldValues(CurBizField, False);
FRightEdit.Text := ValueToText(CurBizField.DataType, FIsINOpr,
AExprItem.FieldValueA);
FBetweenEdit.Text :=
ValueToText(CurBizField.DataType, FIsINOpr, AExprItem.FieldValueB);
end;
end;
procedure TSimpleSQLFilterEditor.EditorToText(var AText: string);
const
cBinaryText = '%s %s %s';
cUnaryText = '%s %s';
cBetweenText = '%s %s %s AND %s';
var
lBizField: TBizField;
lRelationOpr: string; //这里新定义的变量
begin
AText := '';
if FLeftEdit.ItemIndex = -1 then Exit;
lBizField := CurBizField;
lRelationOpr := FRelationOpr.Text; //加这一句
if lRelationOpr = '好像' then lRelationOpr := 'LIKE'; //加这一句
case OprKind of
TOprKind.okBinary:
AText := Format(cBinaryText, [lBizField.Origin.FullID, lRelationOpr, //修改FRelationOpr.Text为lRelationOpr
TextToValue(lBizField.DataType, FIsINOpr, FRightEdit.Text)]);
TOprKind.okUnary:
AText := Format(cUnaryText, [lBizField.Origin.FullID, lRelationOpr]); //同上
TOprKind.okBetween:
AText := Format(cBetweenText, [lBizField.Origin.FullID, lRelationOpr, //同上
TextToValue(lBizField.DataType, FIsINOpr, FRightEdit.Text),
TextToValue(lBizField.DataType, FIsINOpr, FBetweenEdit.Text)]);
else
OprKindError;
end;
end; |