PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → [WD20] - How to make HReadSeekFirst case insensitive and exact match?
[WD20] - How to make HReadSeekFirst case insensitive and exact match?
Débuté par Yogi Yang, 11 jan. 2018 08:20 - 3 réponses
Posté le 11 janvier 2018 - 08:20
Hello,

I have been using HReadSeekFirst without giving it any thought. And it has worked properly satisfying my requirements. But today I ran into two problems which I cannot solve:

1. How to make HReadSeekFirst case insensitive and exact-match?
2. How to seek on multiple fields when the fields being searched do not have corresponding composite key defined in Analysis?

TIA
Posté le 11 janvier 2018 - 12:19
Hi Yogi,

You can change the key within the data file, to case sensitive
Posté le 11 janvier 2018 - 16:32
Hi


Hreadseekfirst just uses the keys as they are defined, therefore:

1. How to make HReadSeekFirst case insensitive and exact-match?

You don't.. You change the settings of the key in the analysis (or add another key with different settings)

2. How to seek on multiple fields when the fields being searched do not have corresponding composite key defined in Analysis?

Yo don't. You create a new composite key -OR- you use a query and accept the fact that because you DIDN'T create the appropriate key, it will be slow.

Best regards
Posté le 11 janvier 2018 - 16:58
Hi Yogi,

2. How to seek on multiple fields when the fields being searched do not have corresponding composite key defined in Analysis?

Off the top of my head (and some this may not work as expected...QA is your friend):

a) I have never used it so not clear on it's capabilities, but would HBuildKeyValue be of any use?

b) Could you use HFilter?

c) Use a query? Something like...
select somefield1, somefield2 from somefile
where field1 = yourvalue1 and
where field2 >= yourvalue2 and
where field3 IN (yourlist)
Will probably have to use StringBuild to build the sql statement.

d) Last resort, full table scan using programming... hReadFirst physical record number 1 and check the fields in the record against variables containing your search values. If found add it to your view, if not hReadNext on to the next record until hOut. If you do that I would use the function that disregards case and punctuation when comparing the search value against the value in the file. Should not be too bad if the file is small and especially not to bad if the disk is a SSD.