Home General

Autosearch fields / dialog

edited July 2001 in General
ok, I'd like to create a set of Autosearch fields, that will show up on
their own tab, kind of like when you have two pipelines, using the
beforeautosearchdialogcreate event, I tried the following but it only
added to the end of the existing list.

Report.CreateAutoSearchCriteria('Options','Testfield',soEqual,'!',true);

So, Is there a way to do this?

Andrew Love

Comments

  • edited July 2001
    You can reorder the search criteria.

    I did something similar before with order by fields on a sql object. There
    is a TdaSql.ClearCriteria method to free the criteria fields.

    procedure TmyDaSQLManipulator.ReverseOrderBy(aSQL: TdaSQL);
    var
    lOrderByField: TdaField;
    lOrderBys: TList;
    liIndex: Integer;
    begin

    lOrderBys := TList.Create;

    {extract the order by fields and put into a list}
    for liIndex := 0 to (aSQL.OrderByFieldCount - 1) do
    begin
    lOrderByField := TdaField.Create(Self);

    lOrderByField.Assign(aSQL.OrderByFields[liIndex]);

    lOrderBys.Add(lOrderByField);
    end;

    {free the order bys from the sql object's order by list}
    aSQL.ClearOrderByFields;

    for liIndex := (lOrderBys.Count - 1) downto 0 do
    aSQL.AddOrderByField(lOrderBys[liIndex], True);

    lOrderByField := nil;
    lOrderByField.Free;

    lOrderBys.Free;

    end;


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited July 2001
    Hmm, Actually I simply made some significant changes to the autosearch
    dialog, I already had my own copy of the autosearch dialog which had about
    5 custom autosearch panels, (date time pickers, lookups on data fields
    such as the employee ID that kind of thing) so I copied the code for the
    autosearch tabsheet and made some fairly big changes.. for example. Now
    instead of having 1 tab for each dataview, there are simply 2 tabs. "Data
    Selection" and "Options"
    And I hard coded the titles of the autosearch dialog to say "Settings"
    instead of "Search"

    I created a passthrough function to create the "Option" fields. Everything
    works great!, the only thing I haven't figured out is how I can remove a
    user create autosearch field. DM doesn't give use access to the actual TList
    for the fields, and provides no way to remove a single Autosearch field.
    any idea?

    Andrew

  • edited July 2001
    You'll need to extract the TdaSQL object to get at the search criteria. Then
    set the AutoSearch boolean property to false on that criteria object. Is
    this what you mean?

    procedure TmyDadeManipulator.ChangeCriteria(aSQL: TdaSQL; aFieldName:
    String; aOperator: TdaCriteriaOperatorType; aCurrentFieldValue: String);
    var
    lCriteriaField: TdaCriteria;
    liIndex: Integer;
    begin

    {find the search criteria and change it}
    for liIndex := 0 to (aSQL.CriteriaCount - 1) do
    begin
    lCriteriaField := aSQL.Criteria[liIndex];

    if (lCriteriaField.Field <> nil) then
    begin
    if (lCriteriaField.Field.FieldName = aFieldName) and
    (lCriteriaField.Operator = aOperator) and (lCriteriaField.Value =
    aCurrentFieldValue) then
    lCriteriaField.Autosearch := False;
    end;

    end;

    end;

    Cheers,

    Jim Bennett
    Digital Metaphors


This discussion has been closed.