2016-10-06 27 views
0

當我在名稱的起始字母中搜索名稱時,應該顯示以該字母開頭的所有名稱。如何使用瀏覽器以升序或降序搜索和顯示名稱

提示:應該使用開放query`

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. 

` 上面的代碼我有搜索按鈕寫。 enter image description here

+0

如果你想讓它只顯示與同時被鍵入的代碼開頭的名稱,你可能想將其更改爲瀏覽查詢。所以我以爲你之前找到了一位顧客,如果你沒有采取行動,我真的不明白爲什麼你會花時間做這件事。 如果您使用的是AppBuilder,則可能需要爲customer.name開始輸入cust-num的每個客戶嘗試使用 OPEN QUERY {&browse-name}。 – bupereira

回答

0

使用開始匹配字符串的開頭和利用來控制排序順序:

OPEN QUERY q FOR EACH customer 
       WHERE customer.name BEGINS (INPUT customer.name) BY name. 
相關問題