Problem in Searching...

minty_friendminty_friend Member Posts: 38
Hi Experts,

I have created a form which shows marked only customers with their respective stores, but the problem is when I tried to insert a search filter, It wont work.

And when I try to Unmark all, All the customers vanishes(Reason the form is created in such a way that it shows only marked only customers)

Please suggest something....

Comments

  • sunnyksunnyk Member Posts: 280
    What filters? Can you please give us a sample code you wrote?
  • BeliasBelias Member Posts: 2,998
    if you have all the records marked and marked only filter, what do you expect if you unmark the records? they get out of the scope of the filter, and you don't see them anymore :roll:
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • minty_friendminty_friend Member Posts: 38
    I use this code to setup marked only contacts:-
    RetailSetup.GET;
    Cont.RESET;
    Cont.SETCURRENTKEY(Type);
    Cont.SETRANGE(Type,Type::Company);

    IF Cont.FIND('-') THEN REPEAT
    CorpDisc.RESET;
    CorpDisc.SETRANGE("Contact No.",Cont."No.");
    CorpDisc.SETRANGE("Store No.",RetailSetup."Local Store No.");
    IF CorpDisc.FINDFIRST THEN
    Cont.MARK := TRUE;
    UNTIL Cont.NEXT = 0;

    Cont.MARKEDONLY(TRUE);

    COPY(Cont);


    and then i use this code to set search filter in the text box:=


    SearchState := SearchState::Name;
    IF SearchStr <> '' THEN BEGIN
    IF COPYSTR(SearchStr,1,1) <> '*' THEN
    SearchStr := '*' + SearchStr;
    IF STRPOS(SearchStr,'*') > 0 THEN BEGIN
    TreatAsFilter := TRUE;
    IF COPYSTR(SearchStr,STRLEN(SearchStr),1) <> '*' THEN
    SearchStr := SearchStr + '*';
    END
    ELSE
    TreatAsFilter := FALSE;
    END;



    just take a look at the attached file, u will come to know about the actual problem:
  • David_SingletonDavid_Singleton Member Posts: 5,479
    What are you trying to do and why?
    David Singleton
  • hawkeyehawkeye Member Posts: 51
    Why dont you just make the filter on the SourceTableView property or OnOpenForm leaving the standard NAV search and filter functionality to do the job for you?

    BR

    Hawkeye
Sign In or Register to comment.