Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
3
Erster Beitrag:
vor 5 Jahren, 1 Monat
Letzter Beitrag:
vor 5 Jahren, 1 Monat
Beteiligte Autoren:
JP, Al

Searching on Composite keys

Startbeitrag von JP am 31.03.2013 11:35

Hi All,

Using WinDev 17

I'm having some confusing results with searching on a composite key. I have a file that has a composite key based on 2 text items; one is 20 characters in length, the other 30. I want to search on this key. I can see 3 options:


1) Search on Complete( MyString1, 20 ) + Complete( MyString2 , 30 )

HReadSeekFirst( MyFileName , MyCompositeKey , Complete( MyString1, 20 ) + Complete( MyString2 , 30 ) )

This works OK!


2) Search using the HBuildKeyValue() function to build the search key:

MySearchKey is buffer = HBuildKeyValue( MyFileName , MyCompositeKey , MyString1 , MyString2 )

HReadSeekFirst( MyFileName , MyCompositeKey , MySearchKey )


This does not work for me?


3) Search using the recommended method for building the composite search key:

HReadSeekFirst( MyFileName , MyCompositeKey, [ MyString1 , MyString2 ] )

This does not work for me?


The file uses encryption and has various other items and keys.

What am I not understanding in respect of the last 2 search options?

TIA

Antworten:

Hello JP

Windev has never seemed a straightforward as it could be with composite keys and over the years several methods have been introduced and some have been discarded - see the many convert() options.

Option 2 should work if you declare your "MySearchKey" variable as a string instead of a buffer.

Option 3 should work as HReadSeekFirst( MyFileName , MyCompositeKey ,[Complete( MyString1, 20 ), Complete( MyString2 , 30 )] )

I get the most consistent results by using HbuildKeyValue()

Regards
Al

von Al - am 31.03.2013 22:35
Thanks Al. I can make it work if I use the Complete() function to ensure the strings are the matching size to the file items. I will stick with doing that. Thanks.

von JP - am 02.04.2013 11:08
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.