rdd filter

rdd filter

Postby Ehab Samir Aziz » Sat Feb 24, 2007 6:41 pm

I can not find that filter DBSETFILTER(&bFilter,cFilter) is applied to the database . Please can somebody explain why ?

Code: Select all  Expand view

STATIC FUNCTION listmete( oWnd )
*--------------------------

local oDlg, oCol

local oBrw
local nfor,x,cFilter:="",bFilter:=""
local V_me_mc_serl:= space(7)

REQUEST ADS
rddRegister( "ADS", 1 )
rddsetdefault( "ADS" )
AdsSetDeleted(.T.)
SET SERVER LOCAL
SET FILETYPE TO CDX





select 1
USE cust
INDEX ON upper(cust->cu_acct) TO cust
INDEX ON upper(cust->cu_name) TO cust1
INDEX ON upper(cust->cu_coun) TO cust2
INDEX ON upper(cust->cu_city) TO cust3
INDEX ON upper(cust->cu_gove) TO cust4
INDEX ON upper(cust->cu_stre) TO cust5
INDEX ON upper(cust->cu_phon) TO cust6
INDEX ON upper(cust->cu_fax ) TO cust7
INDEX ON upper(cust->cu_mobi) TO cust8
INDEX ON upper(cust->cu_man ) TO cust9
INDEX ON upper(cust->cu_appr) TO cust10
set INDEX TO cust

select 2
USE cont
INDEX ON cont->CT_CU_ACCT+dtoc(cont->ct_strd) TO cont
INDEX ON cont->CT_CU_acct TO cont1
INDEX ON cont->ct_strd TO cont2
INDEX ON cont->ct_endd TO cont3
INDEX ON cont->CT_machno TO cont4
INDEX ON cont->CT_mamc TO cont5
INDEX ON cont->ct_paymet TO cont6
INDEX ON cont->ct_payamt TO cont7
INDEX ON cont->ct_currenc TO cont8
INDEX ON cont->ct_excmet TO cont9
INDEX ON cont->ct_excamt TO cont10
INDEX ON cont->ct_minvol TO cont11
INDEX ON cont->ct_ctna TO cont12
SET INDEX TO cont1

select 3
use mach
index on mach->MC_CU_ACCT to mach
index on UPPER(mach->MC_CU_name) to mach1
index on UPPER(mach->MC_ct_ctna) to mach2
index on UPPER(mach->MC_model) to mach3
index on UPPER(mach->MC_TYPE)+UPPER(mach->MC_model) to mach4
index on (mach->MC_serial) to mach5
index on UPPER(mach->MC_meres) to mach6
index on UPPER(mach->MC_brn) to mach7
index on UPPER(mach->MC_gateway) to mach8
set index to mach5
go top

select 4
use mete
index on mete->ME_mc_serl to mete
index on str(mete->year) + str(mete->month) to mete1
index on mete->me_date to mete2
set index to mete


if MsgGet( "Serial Machine", "Enter Serial Machine", @V_me_mc_serl,;
              "..\lupa.bmp" )
      select 3
      use mach
      set index to mach5
      MSGINFO(IndexKey())
      if ! DbSeek( (V_me_mc_serl ))
         MsgAlert( "I don't find that serial" )
      endif
   endif



? V_me_mc_serl
cFilter :="mete->me_mc_serl" + '=="' + (V_me_mc_serl) + '"'

? cFilter
bFilter = "{||"+cFilter+"}"
? bFilter

select 4
use mete
DBSETFILTER(&bFilter,cFilter)
mete->(DBGOTOP())



   DEFINE DIALOG oDlg of oWnd FROM 0,0 TO 45,128 TITLE "Meter reads browse "

   oBrw := TXBrowse():New( oDlg )
   oBrw:nMarqueeStyle       := MARQSTYLE_HIGHLCELL
   oBrw:nColDividerStyle    := LINESTYLE_BLACK
   oBrw:nRowDividerStyle    := LINESTYLE_BLACK
   oBrw:lColDividerComplete := .t.
   oBrw:nHeaderLines        := 1
   oBrw:nFooterLines        := 1
   oBrw:nDataLines          := 1
   oBrw:lFooter             := .t.
   oBrw:SetRDD()
   oBrw:CreateFromCode()
   oBrw:nTop = 0
   oBrw:nLeft = 0
   oBrw:nWidth = 1000
   oBrw:nHeight =600



   for nFor := 1 to Fcount()


   if nFor=27
      oBrw:aCols[ nFor ]:cHeader       := FieldName( nFor )
      oBrw:aCols[ nFor ]:cFooter       := alltrim(STR(TOTALEM2(),12,0))
      loop
   endif

      *oBrw:aCols[ nFor ]:cHeader       := FieldName( nFor )
      *oBrw:aCols[ nFor ]:cFooter       := FieldName( nFor )
   next


   *oBrw:CreateFromCode()
   *oBrw:UpStable()           // Corrects same page stabilizing Bug
   oBrw:Refresh(.t.)            // Repaint the ListBox





ACTIVATE DIALOG oDlg ON INIT (oBrw:SetSize( 1000, 600 ),BuildButtons( oDlg ),oDlg:Refresh(.t.),oBrw:Refresh(.t.))

RETURN NIL
Ehab Samir Aziz
 
Posts: 334
Joined: Fri Oct 14, 2005 1:54 pm

Postby Armando » Sat Feb 24, 2007 7:55 pm

Ehab:

Try with the traditional way

select 4
use mete
DBSETFILTER( {| | mete->me_mc_serl == V_me_mc_serl },;
"mete->me_mc_serl == V_me_mc_serl" ))
mete->(DBGOTOP())

Good luck, Armando
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
User avatar
Armando
 
Posts: 3085
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Postby Ehab Samir Aziz » Sun Feb 25, 2007 6:42 am

a strange problem has occured . I did the syntax before . The reult of of program is a previous result of another machine serial not the serial entered . I do not have any other function withthe same name !!!!
Code: Select all  Expand view
STATIC FUNCTION listmete( oWnd )
*--------------------------

local oDlg, oCol

local oBrw
local nfor,cFilter:="",bFilter:="",x:=""
local V_me_mc_serl:= space(7)

REQUEST ADS
rddRegister( "ADS", 1 )
rddsetdefault( "ADS" )
AdsSetDeleted(.T.)
SET SERVER LOCAL
SET FILETYPE TO CDX





select 1
USE cust
INDEX ON upper(cust->cu_acct) TO cust
INDEX ON upper(cust->cu_name) TO cust1
INDEX ON upper(cust->cu_coun) TO cust2
INDEX ON upper(cust->cu_city) TO cust3
INDEX ON upper(cust->cu_gove) TO cust4
INDEX ON upper(cust->cu_stre) TO cust5
INDEX ON upper(cust->cu_phon) TO cust6
INDEX ON upper(cust->cu_fax ) TO cust7
INDEX ON upper(cust->cu_mobi) TO cust8
INDEX ON upper(cust->cu_man ) TO cust9
INDEX ON upper(cust->cu_appr) TO cust10
set INDEX TO cust

select 2
USE cont
INDEX ON cont->CT_CU_ACCT+dtoc(cont->ct_strd) TO cont
INDEX ON cont->CT_CU_acct TO cont1
INDEX ON cont->ct_strd TO cont2
INDEX ON cont->ct_endd TO cont3
INDEX ON cont->CT_machno TO cont4
INDEX ON cont->CT_mamc TO cont5
INDEX ON cont->ct_paymet TO cont6
INDEX ON cont->ct_payamt TO cont7
INDEX ON cont->ct_currenc TO cont8
INDEX ON cont->ct_excmet TO cont9
INDEX ON cont->ct_excamt TO cont10
INDEX ON cont->ct_minvol TO cont11
INDEX ON cont->ct_ctna TO cont12
SET INDEX TO cont1

select 3
use mach
index on mach->MC_CU_ACCT to mach
index on UPPER(mach->MC_CU_name) to mach1
index on UPPER(mach->MC_ct_ctna) to mach2
index on UPPER(mach->MC_model) to mach3
index on UPPER(mach->MC_TYPE)+UPPER(mach->MC_model) to mach4
index on (mach->MC_serial) to mach5
index on UPPER(mach->MC_meres) to mach6
index on UPPER(mach->MC_brn) to mach7
index on UPPER(mach->MC_gateway) to mach8
set index to mach5
go top

select 4
use mete
index on mete->ME_mc_serl to mete
index on str(mete->year) + str(mete->month) to mete1
index on mete->me_date to mete2
set index to mete


if MsgGet( "Serial Machine", "Enter Serial Machine", @V_me_mc_serl,;
              "..\lupa.bmp" )
      select 3
      use mach
      set index to mach5
      MSGINFO(IndexKey())
      if ! DbSeek( (V_me_mc_serl ))
         MsgAlert( "I don't find that serial" )
      endif
   endif



? V_me_mc_serl
cFilter :="mete->me_mc_serl" + '=="' + (V_me_mc_serl) + '"'

? cFilter
bFilter = "{||"+cFilter+"}"
? bFilter

/*select 4
use mete
DBSETFILTER(&bFilter,cFilter)
mete->(DBGOTOP())*/
*V_me_mc_serl:="0731370"
select 4
use mete
DBSETFILTER( {| | 4->me_mc_serl == V_me_mc_serl },;
"4->me_mc_serl == V_me_mc_serl" )
4->(DBGOTOP())


   DEFINE DIALOG oDlg of oWnd FROM 0,0 TO 45,128 TITLE "Meter reads browse "

   oBrw := TXBrowse():New( oDlg )
   oBrw:nMarqueeStyle       := MARQSTYLE_HIGHLCELL
   oBrw:nColDividerStyle    := LINESTYLE_BLACK
   oBrw:nRowDividerStyle    := LINESTYLE_BLACK
   oBrw:lColDividerComplete := .t.
   oBrw:nHeaderLines        := 1
   oBrw:nFooterLines        := 1
   oBrw:nDataLines          := 1
   oBrw:lFooter             := .t.
   oBrw:SetRDD()
   oBrw:CreateFromCode()
   oBrw:nTop = 0
   oBrw:nLeft = 0
   oBrw:nWidth = 1000
   oBrw:nHeight =600



   for nFor := 1 to Fcount()


   if nFor=27
      oBrw:aCols[ nFor ]:cHeader       := FieldName( nFor )
      oBrw:aCols[ nFor ]:cFooter       := alltrim(STR(TOTALEM2(),12,0))
      loop
   endif

      *oBrw:aCols[ nFor ]:cHeader       := FieldName( nFor )
      *oBrw:aCols[ nFor ]:cFooter       := FieldName( nFor )
   next


   *oBrw:CreateFromCode()
   *oBrw:UpStable()           // Corrects same page stabilizing Bug
   oBrw:Refresh(.t.)            // Repaint the ListBox





ACTIVATE DIALOG oDlg ON INIT (oBrw:SetSize( 1000, 600 ),BuildButtons( oDlg ),oDlg:Refresh(.t.),oBrw:Refresh(.t.))

RETURN NIL
Ehab Samir Aziz
 
Posts: 334
Joined: Fri Oct 14, 2005 1:54 pm

Postby R.F. » Sun Feb 25, 2007 7:30 am

DON'T USE VARIABLE NAMES IN THE FILTERS !!!!!!!

I've been told it THOSANDS OF TIMES !!!!!!!!

ADS cannot resolve what is INSIDE your program, if you use ALIAS in your field names, ADS cannot go inside you program to see the value of "mete->" so it cannot resolve the filter expression.

You also have an error when creating indexes, Don't use ALIAS, Alias should be used only in the program to make reference to the data fields, but not in indexes or any other operation.
Saludos
R.F.
R.F.
 
Posts: 840
Joined: Thu Oct 13, 2005 7:05 pm

Postby James Bott » Sun Feb 25, 2007 3:27 pm

Rene,

>You also have an error when creating indexes, Don't use ALIAS, Alias should be used only in the program to make reference to the data fields, but not in indexes or any other operation.

Are you saying that with ADS you cannot do something like:

(cAlias)->(eof())

If not, how does ADS keep track of workareas?

(I have never used ADS.)

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 38 guests