Make TEXTBOX with Filter

oioi007oioi007 Member Posts: 41
Hello!

I want to make TextBox and Command button on a form.

for example Textbox ... PS|JR..AH , so if I push Command button it must select entries with filter values from table. how to code this one?

Thanks

Comments

  • SavatageSavatage Member Posts: 7,142
    F7 Is Faster. If you have your heart set on a button you can use sendkeys to progrm F7 :mrgreen:

    how about onValidate of the TEXTBOX
    Setrange("The field you want to filter", "Your textbox filter");

    you'd have to make a filter clear button then 8-[
  • oioi007oioi007 Member Posts: 41
    im new to NAV, I have some tasks to do.. :)

    What you mean in TEXTBOX FILTER?
    I just want to make work filters in TEXTBOX, not use F7 and how to make connection with push button and textbox.

    Customer.SETRANGE("Salesperson Code"), ?? ;
  • SavatageSavatage Member Posts: 7,142
    What I ment by Textbox filter is that you want to use a textbox to hold information. That information is a filter you would like to use.

    Do you have access to the OnPush trigger of a command button?
  • garakgarak Member Posts: 3,263
    what Savatage mean with "Your textbox filter" is your value in your texbox, quasi your variable (SourceExpr for your Textbox).

    Why not should use the user F7. Do you have disabled the filter on permissions :?:

    Well, here a solution with filter in a textbox and use this Filter on a Recordvariable.
    YourTextBoxVariable := 'C|D|B';
    YourRecVariable.setfilter(YourFieldToFilter,YourTextBoxVariable);
    //Now you have filtered the RecordSet in your YourRecVariablecan and you can work with this, for example with a loop 
    

    other, if you will use the filter in TextBox in the form u have designd your textbox you can write following behind the Trigger "OnAfterValidate()" in your TextBox

    You have entered in your Textbox value like this 'A|B|C'
    Rec.setfilter(YourFieldToFilter,YourTextBoxVariable);
    currform.update(false);
    

    Regards
    Do you make it right, it works too!
  • garakgarak Member Posts: 3,263
    sava, your to fast for me :-D
    Do you make it right, it works too!
  • SavatageSavatage Member Posts: 7,142
    As an example we'll use the customer List Form.
    (Might be set as Editable=No - you'll have to change that for this demonstration.

    On the form you add global Variable Type Text.
    Call it SalesPersonFilter.

    On The Form You Will Add a Text Box And Command Button To the Bottom Of The Form (remember Property of these fields Vertglue=Bottom).

    The SourceExp of your Textbox will be Your Variable "SalesPersonFilter".
    On the Trigger OnPush of the command button you can add

    SETRANGE("Salesperson Code",SalesPersonFilter);
    Give it a try.

    If you put the code onAfterValidate then no button is needed. It just does it once you enter what you want.

    Application Designers Guide
    http://download.microsoft.com/download/ ... 1w1adg.pdf
  • SavatageSavatage Member Posts: 7,142
    garak wrote:
    sava, your to fast for me :-D
    This time you got me :lol:
  • garakgarak Member Posts: 3,263
    :-D two persons, same idea. so, i go to bed ....

    good night
    Do you make it right, it works too!
  • oioi007oioi007 Member Posts: 41
    Ok Thanks guys 8)
Sign In or Register to comment.