Saving the value of a flowfilter

Pedro_V.Pedro_V. Member Posts: 4
Hello!

Im trying to filter a table (Employee) with the value from a flowfilter (AuxRecord.Filter) which is on another table (AuxRecord). its datatype is text30. Here's the code.
Employee.SETRANGE(Employee.Status,0);
IF NOT AuxRecord.GET(AuxRecord.AuxCode) THEN ERROR('ERROR');
AuxFilter := AuxRecord.GETFILTER(AuxRecord.Filter);
Employee.SETFILTER("No.", AuxFilter);
END;

The problem is that the flowfilter has no value on this code and nothing is filtered. #-o
Can you guys please give me a hand?

Best regards.

Comments

  • awarnawarn Member Posts: 261
    This would work, if the AuxRecord had the filter hard-coded (which is not likely).

    Employee.SETRANGE(Employee.Status,0);
    IF NOT AuxRecord.GET(AuxRecord.AuxCode) THEN ERROR('ERROR');
    Employee.SETFILTER("No.", AuxRecord.Filter);
    END;


    What you really want is for the AuxRecord to have been passed in, by Var, from a form / function, and have code like this (pretend this is a function)

    function parameter _AuxRec (by var)

    Employee.SETRANGE(Employee.Status,0);
    Employee.SETFILTER("No.", _AuxRec.FlowFilterFieldName);
    Employess.calcfields(..., or FIND...


    -a
  • DenSterDenSter Member Posts: 8,307
    That's just not what flowfilters are there for. Flowfilters in table A are there to manipulate flowfield values in the same table, not to be used as regular filter expressions in table B.
  • Pedro_V.Pedro_V. Member Posts: 4
    awarn wrote:
    This would work, if the AuxRecord had the filter hard-coded (which is not likely).

    Employee.SETRANGE(Employee.Status,0);
    IF NOT AuxRecord.GET(AuxRecord.AuxCode) THEN ERROR('ERROR');
    Employee.SETFILTER("No.", AuxRecord.Filter);
    END;


    What you really want is for the AuxRecord to have been passed in, by Var, from a form / function, and have code like this (pretend this is a function)

    function parameter _AuxRec (by var)

    Employee.SETRANGE(Employee.Status,0);
    Employee.SETFILTER("No.", _AuxRec.FlowFilterFieldName);
    Employess.calcfields(..., or FIND...


    -a

    let me try to explain you guys better.
    what i really want to do is:

    the AuxRecord table is a kind of "setup table" and the report will run according to the parameters that i setup in the table AuxRecord; and one of that parameters is that flowfilter (AuxRecord.Filter).
    so i want to setup a filter previously, save it on the field AuxRecord.Filter, and then apply it to the dataitem. maybe setting that field (AuxRecord.Filter) as a flowfilter isnt the best solution... :-k
    the reason for it be a flowfilter is that i want to validate the filter before i apply it, or else i can write "abcdefg" on that field and when applied it wont filter anything...

    hope i have explained it well...

    Best regards
  • Pedro_V.Pedro_V. Member Posts: 4
    edited 2005-12-16
    Edited Post[/u]
  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    I hope I understand you.

    Maybe you can add a new flowfilter to the resource table and use the setup table to save the last applied filter. This way the setup table field can be a textfield.

    Hey! I see nice christmas emoticons :D
  • awarnawarn Member Posts: 261
    I agree - the setup table should contain a value, as opposed to a flowfilter - otherwise you will have to set the filter on the setup table somehow, then transfer that filter to the Aux table... If it was just a field then you could set the flowfilter based on the value in the field.

    -a
Sign In or Register to comment.