Page 1 of 2
Case problem
Posted: Wed Apr 04, 2018 9:10 am
by asharpham
I have this line of code:
@ 350,250 Textbox Seek1 ;
PARENT Library_1 ;
WIDTH 200
followed soon after by:
SET ORDER TO 1
SEEK Library_1.Seek1.value
The problem is, the result is "not found" because the FIELD is in upper case and the search text is in lower case. I've been trying to think around using UPPER(...) but I don't think this solves my problem. Irrespective of case, if the text matches, I need it to be FOUND.
How have others dealt with this?
Regards,
Alan
Re: Case problem
Posted: Wed Apr 04, 2018 9:44 am
by esgici
asharpham wrote: ↑Wed Apr 04, 2018 9:10 am
...
How have others dealt with this?
...
Hi Alan
Does your <searchValue> and <keyValue> of index expression has equal length (including spaces) ?
You may need something like this:
Code: Select all
nKeyLen := <length_of_ İndex_expression>
SearchValue := UPPER( LEFT( ALLTRIM( Library_1.Seek1.value ), nKeyLen ))
SEEK SearchValue
Also SOFTSEEK keyword may be useful.
Happy HMG'ing
Re: Case problem
Posted: Wed Apr 04, 2018 12:06 pm
by asharpham
If I specify UPPER in my search value, will that successfully find a record that is not all uppercase?
Re: Case problem
Posted: Wed Apr 04, 2018 12:12 pm
by asharpham
The thing is, I have a record that has been entered in all uppercase. When I search using lower case it is not found. When I search using uppercase it is found. But I need to conduct a search that ignores case.
Alan
Re: Case problem
Posted: Wed Apr 04, 2018 12:16 pm
by dragancesu
You have many solutions, one is using uppercase for input and index, something like
index on UPPER(TITLE) to ITITLE
@ 130, 520 TEXTBOX mSEARCH WIDTH 100 UPPERCASE
Better way is attach your program and data
Re: Case problem
Posted: Wed Apr 04, 2018 2:51 pm
by asharpham
I realise it's hard to understand a program when you don't have the source, but in the Windows environment, shouldn't a search (SEEK) work irrepsective of case?
Re: Case problem
Posted: Wed Apr 04, 2018 3:46 pm
by andyglezl
Recuerda,
Clipper = Harbour
HMG es una biblioteca para crear una interfase Gráfica
Como lo hacias en Clipper ? Es lo mismo en Harbour.
-------------------------------------------------------------------
Remember,
Clipper = Harbour
HMG is a library to create a graphical interface
How did you do it in Clipper? It's the same in Harbour.
Re: Case problem
Posted: Wed Apr 04, 2018 4:13 pm
by franco
First can you make your textbox uppercase . I am not sure with this type of entry.
I found hmg will not work with upper(textbox). This works for me. I create a local variable msearch
msearch := textbox.value
seek upper(msearch)
If eof() .or. len(alltrim(YOUR INDEX SEARCH) <> len(alltrim(msearch))
'NOT FOUND'
endif
Franco
Re: Case problem
Posted: Wed Apr 04, 2018 9:51 pm
by dragancesu
I do not know what kind clipper programs you made, but if you're trying to make a windows program now, then the concept is a bit different
On the screen are objects, one is in focus, but it is easily changed by mouse click and therefore you have to predict what will happen when you do something with that object-control
All objects are "live" and something happens when you touch them and programing action
In the attach of a message is a program that searches in a slightly different way, just as a display of possibilities
Re: Case problem
Posted: Thu Apr 05, 2018 5:42 am
by mol
Try to search with softseek, in another case you must have variables with the same length