Is it a bug in TppReport.AutoSearchCriteriaByName in RB6.02
function TppReport.AutoSearchCriteriaByName(const aDataPipelineName,
aFieldName: String): TppAutoSearchField;
......
if (CompareText(aDataPipelineName, lAutoSearchField.DataPipelineName) = 0)
or (CompareText(aFieldName, lAutoSearchField.FieldName) = 0) then
..........
Should use 'And' not 'Or' because if I have 2 dataview in one datamodule and
both dataview has autosearch field.fieldName = 'MyField', then this Function
always return the first AutoSearchField.
I hope this can be fixed in the next version.
Tao
aFieldName: String): TppAutoSearchField;
......
if (CompareText(aDataPipelineName, lAutoSearchField.DataPipelineName) = 0)
or (CompareText(aFieldName, lAutoSearchField.FieldName) = 0) then
..........
Should use 'And' not 'Or' because if I have 2 dataview in one datamodule and
both dataview has autosearch field.fieldName = 'MyField', then this Function
always return the first AutoSearchField.
I hope this can be fixed in the next version.
Tao
This discussion has been closed.
Comments
you the patch files if you would like and you can recompile using your
..\RBuilder\Source\.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
Tao
{---------------------------------------------------------------------------
---}
{ TdaQueryDataView.CreateAutoSearchFields }
procedure TdaQueryDataView.CreateAutoSearchFields(aReport: TppReport);
var
liIndex: Integer;
lCriteria: TdaCriteria;
lField: TppAutoSearchField;
begin
for liIndex := 0 to FSQL.CriteriaCount - 1 do
begin
lCriteria := FSQL.Criteria[liIndex];
if (lCriteria.Field <> nil) and (lCriteria.Field.AutoSearch) then
begin
lField := TppAutoSearchField.Create(Self);
if (lCriteria.IsExpression) then
lField.FieldAlias := lCriteria.Expression
else
lField.FieldAlias := lCriteria.Field.Alias;
lField.DataPipelineName := GetDataPipelineForIndex(0).Name; <---
add this line:)
lField.FieldName := lCriteria.Field.FieldName;
lField.DataType := lCriteria.Field.DataType;
lField.SearchExpression := lCriteria.Value;
lField.SearchOperator :=
daOperatorToppOperator(lCriteria.Operator);
lField.ShowAllValues := lCriteria.Field.ShowAllValues;
lField.Mandatory := lCriteria.Field.Mandatory;
lField.TableAlias := lCriteria.Field.TableAlias;
lField.TableName := lCriteria.Field.TableName;
{save a pointer to the corresponding criteria and dataview}
lField.Criteria := lCriteria;
lField.DataView := Self;
lField.OnChange := AutoSearchFieldChangeEvent;
lField.Parent := aReport;
{establish a free notification relationship}
FLinkedAutoSearchFields.Add(lField);
lField.AddNotify(Self);
end;
end;
end; {procedure, CreateAutoSearchFields}
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com