hi all:
"Set Filter to" with "Set Relation to" not work for RDD "ADS",
same source work fine for RDD "DBFCDX" .
*******************
LOCAL cSALSMAN:="TIM",cCOND
cCOND:="SAL->SALSMAN="+"'"+cSALSMAN+"'"
USE SAL INDEX SAL_NO NEW SHARE // INDEX ON SNO
USE SAL1 INDEX SAL1_DT NEW SHARE
SET RELATION TO SAL1->SNO INTO SAL
SET SCOPE TO dDT1,dDT2
SET FILTER TO &cCOND // ERROR FILTER FOR "ADS" , BUT WORK FINE FOR "DBFCDX"
GO TOP
BROWSE()
********************
Anyone Know how ?
Best Regards
kokoo
set Filter to with set Relation to not work for "ADS&qu
- kokookao2007
- Posts: 59
- Joined: Thu May 17, 2007 8:27 am
Re: set Filter to with set Relation to not work for "AD
Kokoo:
I think I explained it to you in comp.lang.xharbour newsgroup, but here it goes again anyway:
ADS is an EXTERNAL program to your application, so, you cannot use anything related to your program to indicate filters, relations or indexes.
I mean, you cannot use alias, variables or used defined functions in the ADS or RDD related functions or comands. in order to set relations or filters, because ADS CANNOT go into your program code or memory and "inspect" the values of such variables.
This:
This can be valid if you want the relation be handled by the client (it could be slow).
And the problem comes here:
As I explained to you in the xharbour news group, all the filtering stuff MUST be established in a TEXTUAL FORM, since the cCOND expression is wrong form the begining, it will sure crash when comming to this point.
This is the right way:
Remember, ADS is an EXTERNAL programm running out of the cast of your application. ADS doesn't know anything about your programm enviroment and it doesn't have anyway to know about it.
I think I explained it to you in comp.lang.xharbour newsgroup, but here it goes again anyway:
ADS is an EXTERNAL program to your application, so, you cannot use anything related to your program to indicate filters, relations or indexes.
I mean, you cannot use alias, variables or used defined functions in the ADS or RDD related functions or comands. in order to set relations or filters, because ADS CANNOT go into your program code or memory and "inspect" the values of such variables.
The previos expression is not valid, if you are going to use it with ADS you cannot use the "SAL" alias, because ADS cannot know what is the value of "SAL" (this is an internal pointer of your application), so, the right expression is:kokookao2007 wrote: LOCAL cSALSMAN:="TIM",cCOND
cCOND:="SAL->SALSMAN="+"'"+cSALSMAN+"'"
Code: Select all
LOCAL cSALSMAN:="TIM",cCOND
cCOND:="SALSMAN="+"'"+cSALSMAN+"'"
This:
Code: Select all
USE SAL INDEX SAL_NO NEW SHARE // INDEX ON SNO
USE SAL1 INDEX SAL1_DT NEW SHARE
SET RELATION TO SAL1->SNO INTO SAL
SET SCOPE TO dDT1,dDT2
And the problem comes here:
Code: Select all
SET FILTER TO &cCOND // ERROR FILTER FOR "ADS" , BUT WORK FINE FOR "DBFCDX"
BROWSE()
GO TOP
As I explained to you in the xharbour news group, all the filtering stuff MUST be established in a TEXTUAL FORM, since the cCOND expression is wrong form the begining, it will sure crash when comming to this point.
This is the right way:
Code: Select all
cCond := cCOND:="SALSMAN="+"'"+cSALSMAN+"'"
bCond := "{||"+cCond+"}"
DBSETFILTER(&bCond, cCond)
GO TOP
BROWSE()
Saludos
R.F.
R.F.
- kokookao2007
- Posts: 59
- Joined: Thu May 17, 2007 8:27 am
hi Rene :
Thank you for help Again.
In this sample. there is no field "salsman" define in sal1.dbf .
What I edit :
1)add field "salsman" to sal1.dbf
2)Replace Sal->Salsman to Sal1->Salsman for scope condition (by Set relation to)
3)now cCOND:="SALSMAN="+"'"+cSALSMAN+"'" or cCOND:="SAl1->SALSMAN="+"'"+cSALSMAN+"'" Can be work
Any best solution not to edit struct sal1.dbf for both Rdd "dbfcdx" and "ADS" ?
Best Regards
kokoo
Thank you for help Again.
In this sample. there is no field "salsman" define in sal1.dbf .
Code: Select all
cCOND:="SAL->SALSMAN="+"'"+cSALSMAN+"'"
edit to :
cCOND:="SALSMAN="+"'"+cSALSMAN+"'"
// Can not work , SAL1->SALSMAN==>no such field
1)add field "salsman" to sal1.dbf
2)Replace Sal->Salsman to Sal1->Salsman for scope condition (by Set relation to)
3)now cCOND:="SALSMAN="+"'"+cSALSMAN+"'" or cCOND:="SAl1->SALSMAN="+"'"+cSALSMAN+"'" Can be work
Code: Select all
SOURCE CODE:
LOCAL cSALSMAN:="TIM",cCOND
USE SAL INDEX SAL_NO NEW SHARE // INDEX ON SNO
cCOND:="SAL->SALSMAN="+"'"+cSALSMAN+"'"
SET FILTER TO &cCOND
USE SAL1 INDEX SAL1_DT NEW SHARE
*ADD FIELD SALSMAN FIRST
SET RELATION TO SAL1->SNO INTO SAL
SET SCOPE TO dDT1,dDT2
GO TO
DO WHILE ! EOF()
SAL1->(RLOCK())
SAL1->SLASMAN:=SAL->SALSMAN
SAL1->(DBUNLOCK())
SKIP
ENDDO
SET RELATION TO
SAL->(DBCLOSEAREA())
SELE SAL1
cCOND:="SAL1->SALSMAN="+"'"+cSALSMAN+"'"
SET FILTER TO &cCOND
...
...
Best Regards
kokoo