Problem with dbseek

Problem with dbseek

Postby Silvio.Falconi » Tue Sep 25, 2018 5: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: Select all  Expand view

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


the structure of archive is
Code: Select all  Expand view
 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: Select all  Expand view
so when I do the research I do this way


Code: Select all  Expand view
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 November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 6897
Joined: Thu Oct 18, 2012 7:17 pm

Re: Problem with dbseek

Postby Enrico Maria Giordano » Tue Sep 25, 2018 5:35 pm

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

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8515
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Problem with dbseek

Postby Silvio.Falconi » Tue Sep 25, 2018 5: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 November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 6897
Joined: Thu Oct 18, 2012 7:17 pm

Re: Problem with dbseek

Postby karinha » Tue Sep 25, 2018 5:50 pm

Chat_Id ??
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7613
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Problem with dbseek

Postby FranciscoA » Tue Sep 25, 2018 8: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: Select all  Expand view
Chat_id := 12345
cChiaveId := Upper( alltrim(str(Chat_Id)) )

Regards.
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh-MySql-TMySql
User avatar
FranciscoA
 
Posts: 2157
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: Problem with dbseek

Postby solving » Wed Sep 26, 2018 3:22 pm

Chat_id := 12345
cChiaveId := PADL ( Upper( alltrim(str(Chat_Id)) ), 20, SPACE(1) )
o PADR(...) ?
solving
 
Posts: 65
Joined: Fri Jun 05, 2009 7:55 am
Location: Sicily ( ct ) - Italy


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Horizon and 65 guests