2016-10-06 6 views
0

Wenn ich im Namen fill-in mit einem Anfangsbuchstaben eines Namens suche, sollte er alle Namen anzeigen, die mit diesem Buchstaben beginnen.So suchen und zeigen Sie den Namen in aufsteigender oder absteigender Reihenfolge mit dem Browser

TIPP: es sollte offen query` verwenden

DO: 
    IF (input customer.cust-num <> 0) and (input customer.name = "") then do: 
     find first customer where (customer.cust-num = input cust-num) no-error. 
     OPEN QUERY custqry FOR EACH customer. 
     display customer.cust-num customer.name customer.balance customer.discount customer.credit-limit customer.phone customer.contact with browse br1 . /*to display in browser*/ 
     assign 
      ocustnum  = customer.cust-num 
      oName   = customer.Name 
      obalance  = customer.balance 
      odiscount  = customer.discount 
      ocredit-limit = customer.credit-limit 
      ophone  = customer.phone 
      ocontact  = customer.contact . 
     display ocustnum oName obalance odiscount ocredit-limit ophone ocontact with frame default-frame . /*to display in fillin*/ 
    end. 
    ELSE IF (input customer.cust-num = 0) and (input customer.name <> "") then do: 
     find first customer where customer.name begins input name no-error . 
     OPEN QUERY q FOR EACH customer BY name.  
     display customer.cust-num customer.name customer.balance customer.discount customer.credit-limit customer.phone customer.contact with browse br1. /*to display in browser*/ 
     assign 
      ocustnum  = customer.cust-num 
      oName   = customer.Name 
      obalance  = customer.balance 
      odiscount  = customer.discount 
      ocredit-limit = customer.credit-limit 
      ophone  = customer.phone 
      ocontact  = customer.contact . 
     display ocustnum oName obalance odiscount ocredit-limit ophone ocontact with frame default-frame . /*to display in fillin*/ 
    end.  
    ELSE IF (input customer.cust-num <> 0) and (input customer.name <> "") then do: 
     find first customer where (customer.cust-num = input cust-num) and (customer.name begins input name) no-lock no-error . 
     OPEN QUERY cust-query FOR EACH customer BY name. 
     display customer.cust-num customer.name customer.balance customer.discount customer.credit-limit customer.phone customer.contact with browse br1. /*to display in browser*/ 
     assign 
      ocustnum  = customer.cust-num 
      oName   = customer.Name 
      obalance  = customer.balance 
      odiscount  = customer.discount 
      ocredit-limit = customer.credit-limit 
      ophone  = customer.phone 
      ocontact  = customer.contact . 
     display ocustnum oName obalance odiscount ocredit-limit ophone ocontact with frame default-frame . /*to display in fillin*/ 
    end. 
END. 

` der obige Code i für die Suchtaste geschrieben haben. enter image description here

+0

Wenn Sie es wollen, nur die Namen angezeigt werden, die mit dem Code beginnen, der in getippt hat ist, möchten Sie vielleicht ändere es in die Suchabfrage. Also dachte ich, du findest einen Kunden, ich verstehe nicht wirklich, warum du dir die Zeit dafür nehmen würdest, wenn du nicht damit handelst. Wenn Sie sich in AppBuilder befinden, möchten Sie möglicherweise OPEN QUERY {& browse-name} für jeden Kunden ausprobieren, bei dem customer.name mit der Eingabe von cust-num beginnt. – bupereira

Antwort

0

Verwenden BEGINNT den Beginn einer Zeichenfolge zu entsprechen und um das Sortieren zu steuern VON:

OPEN QUERY q FOR EACH customer 
       WHERE customer.name BEGINS (INPUT customer.name) BY name. 
Verwandte Themen