PDA

View Full Version : Autocomplete (index with more fields)



Ditte
9-Oct-2005, 07:28 AM
Hallo,

Iīve tested autocomplete (DbGrid_AutoComplete) with the order and in a view
of myself. Itīs very nice.
It works fine if I use a column with a field artikel.artnr --> index 1 =
artikel.artnr
It works fine if I use a column with a field artikel.fa --> index 2 =
artikel.fa ; artikel.such ; artike.anr

It donīt work if I use a column with a field artikel.such --> index 2 =
artikel.fa ; artikel.such ; artike.anr
must there be a index, where artikel.such the first field of the index
is?

Dittmar

David Martinko
9-Oct-2005, 12:45 PM
Simple answer.. yes.

Long answer... I built in the ability for you to manually fill the list if
you ever find a need to load data yourself. This would be such a time. See
the Sample.vw for an example of how to do this.

--
David Martinko
Redeemed Software
248-535-7495
RedeemedSoftware(SHIFT+2)Hotmail(PERIOD)com
www.redeemedsoftware.com

"Dittmar Stiebitz" <pankow@kus-bau.de> wrote in message
news:hPA$NwMzFHA.2056@dacmail.dataaccess.com...
> Hallo,
>
> Iīve tested autocomplete (DbGrid_AutoComplete) with the order and in a
> view of myself. Itīs very nice.
> It works fine if I use a column with a field artikel.artnr --> index 1 =
> artikel.artnr
> It works fine if I use a column with a field artikel.fa --> index 2 =
> artikel.fa ; artikel.such ; artike.anr
>
> It donīt work if I use a column with a field artikel.such --> index 2 =
> artikel.fa ; artikel.such ; artike.anr
> must there be a index, where artikel.such the first field of the index
> is?
>
> Dittmar
>
>
>

Dittmar Stiebitz
10-Oct-2005, 04:25 AM
Sorry,
I had looked at your sample.
The package is a fine work.
Please have a look at my application (only the column 1dosnīt work):
Object oDbGrid_AutoComplete1 is a DbGrid_AutoComplete
Set Main_File to Artikel.File_Number
Set Ordering to 1
Set Size to 177 619
Set Location to 63 11
Set peAnchors to anAll
Set Wrap_State to TRUE

Begin_Row
Entry_Item Artikel.Such
Entry_Item Artikel.Art
Entry_Item Artikel.Fa
Entry_Item Artikel.Rechtxt1
Entry_Item Land.Kz
Entry_Item A_sorte.Text
Entry_Item A_verp.Text
End_Row

Set Form_Width item 0 to 125
Set Header_Label item 0 to "Such"

Set Form_Width item 1 to 48
Set Header_Label item 1 to "Art"

Set Form_Width item 2 to 24
Set Header_Label item 2 to "Fa"

Set Form_Width item 3 to 177
Set Header_Label item 3 to "Rechtxt1"

Set Form_Width item 4 to 46
Set Header_Label item 4 to "Kz"

Set Form_Width item 5 to 133
Set Header_Label item 5 to "Text"

Set Form_Width item 6 to 120
Set Header_Label item 6 to "Text"


//AB-StoreStart
//index 1 Fa ; ANR
//index 2 Fa ; SUCH ; ANR
//index 3 ART
//index 4 RECHTXT1 ; FA ; SUCH ; ANR


// column 1 autocomplete
Set OnlyOnNewRecord item 0 to FALSE // allow prompt even when a record
exists
Set AutoComplete_Index item 0 to 2// index#
Send Add_Display_Column 0 (Artikel_DD(Self)) File_Field Artikel.such
100
Send Add_Display_Column 0 (Artikel_DD(Self)) File_Field Artikel.fa 0
Send Add_Display_Column 0 (Artikel_DD(Self)) File_Field
Artikel.rechtxt1 200
Send Add_Display_Column 0 (Artikel_DD(Self)) File_Field Artikel.anr 0
Send Add_Display_Column 0 (Artikel_DD(Self)) File_Field Artikel.recnum
0

// column 2 autocomplete
Set OnlyOnNewRecord item 1 to FALSE // allow prompt even when a
record exists
Set AutoComplete_Index item 1 to 3 // index#
Send Add_Display_Column 1 (Artikel_DD(Self)) File_Field Artikel.art 25
Send Add_Display_Column 1 (Artikel_DD(Self)) File_Field
Artikel.rechtxt1 200
Send Add_Display_Column 1 (Artikel_DD(Self)) File_Field Artikel.anr 15
Send Add_Display_Column 1 (Artikel_DD(Self)) File_Field Artikel.fa 15
Send Add_Display_Column 1 (Artikel_DD(Self)) File_Field Artikel.recnum
0

// column 3 autocomplete
Set OnlyOnNewRecord item 2 to FALSE // allow prompt even when a
record exists
Set AutoComplete_Index item 2 to 2 // index#
Send Add_Display_Column 2 (Artikel_DD(Self)) File_Field Artikel.fa 10
Send Add_Display_Column 2 (Artikel_DD(Self)) File_Field Artikel.such
200
Send Add_Display_Column 2 (Artikel_DD(Self)) File_Field Artikel.anr 15
Send Add_Display_Column 2 (Artikel_DD(Self)) File_Field Artikel.recnum
15

// column 4 autocomplete
Set OnlyOnNewRecord item 3 to FALSE // allow prompt even when a
record exists
Set AutoComplete_Index item 3 to 4 // index#
Send Add_Display_Column 3 (Artikel_DD(Self)) File_Field
Artikel.rechtxt1 200
Send Add_Display_Column 3 (Artikel_DD(Self)) File_Field Artikel.art 0
Send Add_Display_Column 3 (Artikel_DD(Self)) File_Field Artikel.anr 0
Send Add_Display_Column 3 (Artikel_DD(Self)) File_Field Artikel.fa 0
Send Add_Display_Column 3 (Artikel_DD(Self)) File_Field
Artikel.recnum 0

Procedure Accepted
Integer iRecnum
If (Current_Col(Self) = 0) Begin
Get Integer_Value of oAux_Value item 4 to iRecnum
Send Find_By_Recnum of Artikel_DD Artikel.File_Number iRecnum
End
If (Current_Col(Self) = 1) Begin
Get Integer_Value of oAux_Value item 4 to iRecnum
Send Find_By_Recnum of Artikel_DD Artikel.File_Number iRecnum
End
If (Current_Col(Self) = 2) Begin
Get Integer_Value of oAux_Value item 3 to iRecnum
Send Find_By_Recnum of Artikel_DD Artikel.File_Number iRecnum
End
If (Current_Col(Self) = 3) Begin
Get Integer_Value of oAux_Value item 4 to iRecnum
Send Find_By_Recnum of Artikel_DD Artikel.File_Number iRecnum
End
End_Procedure // Accepted
//AB-StoreEnd

End_Object // oDbGrid_AutoComplete1


All works fine, only column 1 donīt work.

Please have a look at.

Dittmar

David Martinko
10-Oct-2005, 11:20 AM
Dittmar,

Set OnlyOnNewRecord item 0 to FALSE // allow prompt even when a record
exists
//Set AutoComplete_Index item 0 to 2// index#
//Send Add_Display_Column 0 (Artikel_DD(Self)) File_Field Artikel.such 100
//Send Add_Display_Column 0 (Artikel_DD(Self)) File_Field Artikel.fa 0
//Send Add_Display_Column 0 (Artikel_DD(Self)) File_Field Artikel.rechtxt1
200
//Send Add_Display_Column 0 (Artikel_DD(Self)) File_Field Artikel.anr 0
//Send Add_Display_Column 0 (Artikel_DD(Self)) File_Field Artikel.recnum 0

Set pbManualFillList item 0 to TRUE
Send Add_Display_Column 0 0 0 100 // Artikel.such
Send Add_Display_Column 0 0 0 0 // Artikel.fa
Send Add_Display_Column 0 0 0 200 // Artikel.rechtxt
Send Add_Display_Column 0 0 0 0 // Artikel.anr
Send Add_Display_Column 0 0 0 0 // Artikel.recnum

Procedure Manual_Fill_List Handle hList String sSeedValue
//ToDo: Add your own find here.
// add your records to the list using "Send Add_Item Of hList msg_None
sValue"
// you will need to use that message for each column in your display. So
what you have
// may look something like this:
Clear Atrikel
Move "A" to Artikel.fa
Move sSeedValue to Artikel.Such
Find ge Artikel.fa
If (Found) Indicate Found as (Artikel.fa = "A")
If (Found) Indicate Found as (Left(Artikel.Such,
Length(sSeedValue))=sSeedValue)
While (Found)
Send Add_Item Of hList msg_None Artikel.Such
Send Add_Item Of hList msg_None Artikel.fa
Send Add_Item Of hList msg_None Artikel.rechtxt1
Send Add_Item Of hList msg_None Artikel.anr
Send Add_Item Of hList msg_None Artikel.recnum
Find gt Artikel.fa
If (Found) Indicate Found as (Artikel.fa = "A")
If (Found) Indicate Found as (Left(Artikel.Such,
Length(sSeedValue))=sSeedValue)
Loop
End_Procedure // Manual_Fill_List


HTH,

Examples are provided in the Sample.vw which can be run in the order entry
sample workspace.

--
David Martinko
Redeemed Software
248-535-7495
RedeemedSoftware(SHIFT+2)Hotmail(PERIOD)com
www.redeemedsoftware.com

"Dittmar Stiebitz" <dittmar.stiebitz@t-online.de> wrote in message
news:zWwn4wXzFHA.5020@dacmail.dataaccess.com...
> Sorry,
> I had looked at your sample.
> The package is a fine work.
> Please have a look at my application (only the column 1dosnīt work):
> Object oDbGrid_AutoComplete1 is a DbGrid_AutoComplete
> Set Main_File to Artikel.File_Number
> Set Ordering to 1
> Set Size to 177 619
> Set Location to 63 11
> Set peAnchors to anAll
> Set Wrap_State to TRUE
>
> Begin_Row
> Entry_Item Artikel.Such
> Entry_Item Artikel.Art
> Entry_Item Artikel.Fa
> Entry_Item Artikel.Rechtxt1
> Entry_Item Land.Kz
> Entry_Item A_sorte.Text
> Entry_Item A_verp.Text
> End_Row
>
> Set Form_Width item 0 to 125
> Set Header_Label item 0 to "Such"
>
> Set Form_Width item 1 to 48
> Set Header_Label item 1 to "Art"
>
> Set Form_Width item 2 to 24
> Set Header_Label item 2 to "Fa"
>
> Set Form_Width item 3 to 177
> Set Header_Label item 3 to "Rechtxt1"
>
> Set Form_Width item 4 to 46
> Set Header_Label item 4 to "Kz"
>
> Set Form_Width item 5 to 133
> Set Header_Label item 5 to "Text"
>
> Set Form_Width item 6 to 120
> Set Header_Label item 6 to "Text"
>
>
> //AB-StoreStart
> //index 1 Fa ; ANR
> //index 2 Fa ; SUCH ; ANR
> //index 3 ART
> //index 4 RECHTXT1 ; FA ; SUCH ; ANR
>
>
> // column 1 autocomplete
> Set OnlyOnNewRecord item 0 to FALSE // allow prompt even when a record
> exists
> Set AutoComplete_Index item 0 to 2// index#
> Send Add_Display_Column 0 (Artikel_DD(Self)) File_Field Artikel.such
> 100
> Send Add_Display_Column 0 (Artikel_DD(Self)) File_Field Artikel.fa 0
> Send Add_Display_Column 0 (Artikel_DD(Self)) File_Field
> Artikel.rechtxt1 200
> Send Add_Display_Column 0 (Artikel_DD(Self)) File_Field Artikel.anr 0
> Send Add_Display_Column 0 (Artikel_DD(Self)) File_Field
> Artikel.recnum 0
>
> // column 2 autocomplete
> Set OnlyOnNewRecord item 1 to FALSE // allow prompt even when a
> record exists
> Set AutoComplete_Index item 1 to 3 // index#
> Send Add_Display_Column 1 (Artikel_DD(Self)) File_Field Artikel.art
> 25
> Send Add_Display_Column 1 (Artikel_DD(Self)) File_Field
> Artikel.rechtxt1 200
> Send Add_Display_Column 1 (Artikel_DD(Self)) File_Field Artikel.anr
> 15
> Send Add_Display_Column 1 (Artikel_DD(Self)) File_Field Artikel.fa 15
> Send Add_Display_Column 1 (Artikel_DD(Self)) File_Field
> Artikel.recnum 0
>
> // column 3 autocomplete
> Set OnlyOnNewRecord item 2 to FALSE // allow prompt even when a
> record exists
> Set AutoComplete_Index item 2 to 2 // index#
> Send Add_Display_Column 2 (Artikel_DD(Self)) File_Field Artikel.fa 10
> Send Add_Display_Column 2 (Artikel_DD(Self)) File_Field Artikel.such
> 200
> Send Add_Display_Column 2 (Artikel_DD(Self)) File_Field Artikel.anr
> 15
> Send Add_Display_Column 2 (Artikel_DD(Self)) File_Field
> Artikel.recnum 15
>
> // column 4 autocomplete
> Set OnlyOnNewRecord item 3 to FALSE // allow prompt even when a
> record exists
> Set AutoComplete_Index item 3 to 4 // index#
> Send Add_Display_Column 3 (Artikel_DD(Self)) File_Field
> Artikel.rechtxt1 200
> Send Add_Display_Column 3 (Artikel_DD(Self)) File_Field Artikel.art
> 0
> Send Add_Display_Column 3 (Artikel_DD(Self)) File_Field Artikel.anr
> 0
> Send Add_Display_Column 3 (Artikel_DD(Self)) File_Field Artikel.fa 0
> Send Add_Display_Column 3 (Artikel_DD(Self)) File_Field
> Artikel.recnum 0
>
> Procedure Accepted
> Integer iRecnum
> If (Current_Col(Self) = 0) Begin
> Get Integer_Value of oAux_Value item 4 to iRecnum
> Send Find_By_Recnum of Artikel_DD Artikel.File_Number iRecnum
> End
> If (Current_Col(Self) = 1) Begin
> Get Integer_Value of oAux_Value item 4 to iRecnum
> Send Find_By_Recnum of Artikel_DD Artikel.File_Number iRecnum
> End
> If (Current_Col(Self) = 2) Begin
> Get Integer_Value of oAux_Value item 3 to iRecnum
> Send Find_By_Recnum of Artikel_DD Artikel.File_Number iRecnum
> End
> If (Current_Col(Self) = 3) Begin
> Get Integer_Value of oAux_Value item 4 to iRecnum
> Send Find_By_Recnum of Artikel_DD Artikel.File_Number iRecnum
> End
> End_Procedure // Accepted
> //AB-StoreEnd
>
> End_Object // oDbGrid_AutoComplete1
>
>
> All works fine, only column 1 donīt work.
>
> Please have a look at.
>
> Dittmar
>
>

Ditte
10-Oct-2005, 06:41 PM
Thanks,

it works. Now Iīve unterstand it.

Dittmar