Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Incremental search on numeric
Message
 
À
07/04/2003 02:50:21
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00774073
Message ID:
00774686
Vues:
9
>Tracy,
>What kind of ordering logic on numbers would first go to 680 then 6500 ? I'm afraid in that case you'd hardcode search values.
>Cetin
>

Cetin,

Numerically 680 comes before 6500. However, alphabetically, 65 comes before 68. Here is my solution, I changed your code just a little to get where I wanted.

Thank you everyone for your input, it helped get to this point.

Tracy
oForm = Createobject('MyForm')
oForm.Show
Read Events

Define Class myform As Form
  DataSession = 2
  Top = 0
  Left = 0
  Height = 289
  Width = 312
  DoCreate = .T.
  Caption = "Form1"
  Name = "Form1"

  Add Object text1 As TextBox With ;
    Height = 23, Left = 84, ;
    Top = 24, Width = 100, Name = "Text1"

  Add Object grid1 As Grid With ;
    ColumnCount = 1, Height = 204, ;
    Left = 84, Panel = 1, ;
    RecordSource = "sorttest", ;
    Top = 60, Width = 176, ;
    Name = "Grid1", ;
    Column1.ControlSource = "sorttest.skno", ;
    Column1.Width = 136, ;
    Column1.Name = "Column1"

  Add Object label1 As Label With ;
    Caption = "Search", ;
    Height = 17, Left = 12, Top = 24, ;
    Width = 40, Name = "Label1"

  Procedure Load
  Create Cursor SORTTEST (SKNO i)
**--	  For ix=1 To 100000
**--	    Insert Into SORTTEST Values (ix)
**--	  Endfor
  Insert Into SORTTEST Values (250)
  Insert Into SORTTEST Values (350)
  Insert Into SORTTEST Values (650)
  Insert Into SORTTEST Values (6300)
  Locate
  Index On SKNO Tag SKNO
  Index On Padl(SKNO,10,'0') Tag SKNOA
  set order to 0 && Intensify we don't need it to be current order
Endproc

  Procedure text1.InteractiveChange
  For nSeekLoop = 10 To 1 Step - 1
     If Seek(Padl(Trim(This.Value),nSeekLoop,'0'),'sorttest','sknoa')
        Exit
     EndIf
  EndFor
  With This.Parent.grid1
    .Tag = Trans(Recno())
    .Refresh()
  Endwith
Endproc

  Procedure grid1.Init
  This.SetAll('DynamicBackColor',;
    'iif(RECNO()=VAL(this.Tag),RGB(0,255,255),RGB(255,255,255))')
  This.Column1.header1.Caption = "SkNo"
Endproc
  Procedure QueryUnload
  Clear Events
Endproc
Enddefine
Tracy
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform