Case problem

Moderator: Rathinagiri

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

Case problem

Post by asharpham » Wed Apr 04, 2018 9:10 am

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: 4452
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Has thanked: 332 times
Been thanked: 101 times
Contact:

Post by esgici » Wed Apr 04, 2018 9:44 am

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
Has thanked: 14 times

Post by asharpham » Wed Apr 04, 2018 12:06 pm

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
Has thanked: 14 times

Post by asharpham » Wed Apr 04, 2018 12:12 pm

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: 560
Joined: Mon Jun 24, 2013 11:53 am
DBs Used: DBF, MySQL, Oracle
Location: Subotica, Serbia
Has thanked: 14 times
Been thanked: 101 times

Post by dragancesu » Wed Apr 04, 2018 12:16 pm

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
Has thanked: 14 times

Post by asharpham » Wed Apr 04, 2018 2:51 pm

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: 981
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Has thanked: 20 times
Been thanked: 41 times
Contact:

Post by andyglezl » Wed Apr 04, 2018 3:46 pm

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: 255
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Been thanked: 9 times

Post by franco » Wed Apr 04, 2018 4:13 pm

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

User avatar
dragancesu
Posts: 560
Joined: Mon Jun 24, 2013 11:53 am
DBs Used: DBF, MySQL, Oracle
Location: Subotica, Serbia
Has thanked: 14 times
Been thanked: 101 times

Post by dragancesu » Wed Apr 04, 2018 9:51 pm

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 33 times

User avatar
mol
Posts: 3039
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 170 times
Been thanked: 92 times
Contact:

Post by mol » Thu Apr 05, 2018 5:42 am

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

Post Reply