FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Problem with dbseek
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM
Problem with dbseek
Posted: Tue Sep 25, 2018 05:13 PM
I have to search in an archive if an Id exists or not
I get the variable Chat_Id from a hash and I saw that it is a numeric variable
in the archive where I have to look for this variable I have a string field and the archive is indexed in this way
Code (fw): Select all Collapse
 
INDEX ON UPPER(NumeroID) TAG TEACH01 EVAL (oProgress:SetPos(nProgress++), Sysrefresh()) EVERY 1


the structure of archive is
Code (fw): Select all Collapse
  DbCreate(cDir+'TE',  { { "NumeroId", "C", 20, 0 },;
                            { "fname", "C", 20, 0  },;
                            { "uname", "C", 20, 0  },;
                            { "lname", "C", 20, 0  },;
                            { "isteacher", "L", 1, 0},;
                            { "isadmin", "L", 1, 0} }, 'DBFCDX')





Code (fw): Select all Collapse
so when I do the research I do this way


Code (fw): Select all Collapse
cChiaveId:=alltrim(str(Chat_Id))

 SELECT TE
    TE->(OrdSetFocus(1))
    TE->(DbGoTop())
    if ! TE->(DbSeek( cChiaveId, .t. ))
            else
               lKnown:=.t.
               listeacher= TE->isteacher
               lisadmin := TE->isadmin
endif


the problem is that the search never recognizes the ID number, where is the error?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: Problem with dbseek
Posted: Tue Sep 25, 2018 05:35 PM

Can you show what is in NumeroId field? Are there spaces before the number?

EMG

Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM
Re: Problem with dbseek
Posted: Tue Sep 25, 2018 05:49 PM

no no space
but the error is sometimes for a sample now for two times return right and then error

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 8523
Joined: Tue Dec 20, 2005 07:36 PM
Re: Problem with dbseek
Posted: Tue Sep 25, 2018 05:50 PM

Chat_Id ??

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 2170
Joined: Fri Jul 18, 2008 01:24 AM
Re: Problem with dbseek
Posted: Tue Sep 25, 2018 08:12 PM
Hi.

INDEX ON UPPER(NumeroID) TAG TEACH01 EVAL (oProgress:SetPos(nProgress++), Sysrefresh()) EVERY 1

If you have created the index key using upper, I think you have to use upper in the seeking.
Code (fw): Select all Collapse
Chat_id := 12345
cChiaveId := Upper( alltrim(str(Chat_Id)) )

Regards.
Francisco J. Alegría P.

Chinandega, Nicaragua.



Fwxh-MySql-TMySql
Posts: 65
Joined: Fri Jun 05, 2009 07:55 AM
Re: Problem with dbseek
Posted: Wed Sep 26, 2018 03:22 PM

Chat_id := 12345
cChiaveId := PADL ( Upper( alltrim(str(Chat_Id)) ), 20, SPACE(1) )
o PADR(...) ?

Continue the discussion