Case problem

Moderator: Rathinagiri

asharpham
Posts: 55
Joined: Sat Mar 24, 2018 2:48 pm
DBs Used: DBF

Case problem

Post 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
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Case problem

Post 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 :D
Viva INTERNATIONAL HMG :D
asharpham
Posts: 55
Joined: Sat Mar 24, 2018 2:48 pm
DBs Used: DBF

Re: Case problem

Post by asharpham »

If I specify UPPER in my search value, will that successfully find a record that is not all uppercase?
asharpham
Posts: 55
Joined: Sat Mar 24, 2018 2:48 pm
DBs Used: DBF

Re: Case problem

Post 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
User avatar
dragancesu
Posts: 920
Joined: Mon Jun 24, 2013 11:53 am
DBs Used: DBF, MySQL, Oracle
Location: Subotica, Serbia

Re: Case problem

Post 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
asharpham
Posts: 55
Joined: Sat Mar 24, 2018 2:48 pm
DBs Used: DBF

Re: Case problem

Post 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?
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: Case problem

Post 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.
Andrés González López
Desde Guadalajara, Jalisco. México.
franco
Posts: 816
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Location: Canada

Re: Case problem

Post 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
All The Best,
Franco
Canada
User avatar
dragancesu
Posts: 920
Joined: Mon Jun 24, 2013 11:53 am
DBs Used: DBF, MySQL, Oracle
Location: Subotica, Serbia

Re: Case problem

Post 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
Attachments
search.zip
(2.57 KiB) Downloaded 176 times
User avatar
mol
Posts: 3718
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: Case problem

Post by mol »

Try to search with softseek, in another case you must have variables with the same length
Post Reply