Options

TableRelation Ignores my Table Filter

BagheeraBagheera Member Posts: 57
When clicking on the lookup button of the field Doctor No. Ι want to get the lookup list displaying ONLY the doctors that have their Hospital Code set to a value that I get from another field. So this is the TableRelation in complete
Doctor.No. WHERE (No.=FIELD(Doctor Code),Hospital Code=FIELD(Hospital Code))


And this is the Table Filter alone.
No.=FIELD(Doctor Code),Hospital Code=FIELD(Hospital Code)

D@mn thing ignores me or dumb me that I get ignored, the full list of doctors comes up... Any ideas?
animateduserbar6sx.gif

Comments

  • Options
    pduckpduck Member Posts: 147
    If the Hospital Code isn't the Primary Key your Lookup won't work or let's say ... it shows you all records :) So you must program the Lookup into the OnLookup-Trigger.
  • Options
    BagheeraBagheera Member Posts: 57
    OK, I see

    in OnLookup of that field I have specified a Recordset I filtered it the way I want and I assigned it to a Form (the form is specified in Globals).

    How do I assign the Global Form with the filtered record to my filter in order to display it. At the moment it has the lookup button but it does nothing when you click it...

    Thanks for ur valuable help.
    animateduserbar6sx.gif
  • Options
    BagheeraBagheera Member Posts: 57
    OK,

    found an answer in a previous post...

    Doctors.RESET;
    Doctors.SETCURRENTKEY("Hospital Code");
    Doctors.SETFILTER("Hospital Code", "Hospital Code");
    
    IF FORM.RUNMODAL(55006, Doctors) = ACTION::LookupOK THEN BEGIN
      Text := Doctors."No.";
      EXIT(TRUE);
    END ELSE
      EXIT(FALSE);
    

    It works excellent now. Thank you.
    animateduserbar6sx.gif
Sign In or Register to comment.