|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
rowfilter not working correctlyresults. Our filter is as follows: "CLIENT_ID='T1000' AND NOT (RES_RATE=0 AND BP_SIT_SYS=0 AND BP_SIT_DIA=0 AND PULSE_API=0 AND TEMPERATUR=0 AND WEIGHT_NUT=0)" The results we expect are records that have a Client_ID of T1000 and ALL other data is NOT 0. The logic is pretty simple, we simply don't want to show records for the client in which ALL information is zero (fields will never be empty or null, we always make them 0 if no data is entered). Lets say PUSLE_API is 90 and everything else is zero, we would then want to show that record; just hide all records in which RES_RATE, BP_SIT_SYS, BP_SIT_DIA, PULSE_API, TEMPURATUR, and WEIGHT_NUT are ALL zero. The problem we are having with this filter is that when it goes to evaluate the NOT expression it looks at the first expression in the parenthises and evaluates the entire expression based on that one part of the expression. for example, since RES_RATE is currently first in the expression whenever RES_RATE is zero it will filter that record, even if every other field has values in it. So it will only show records in which RES_RATE is not zero. If we move TEMPERATUR to be first in the NOT expression then it will only show records in which TEMPERATUR is not zero. We have tried using OR instead of AND with a little more success, but still having a similar problem. The expression we are using now SHOULD work. So why isn't it? Anyone with any ideas/suggestions your input would be greatly appreciated. Maybe you can try something like this:
CLIENT_ID='T1000' AND (NOT RES_RATE=0 AND NOT BP_SIT_SYS=0 AND NOT BP_SIT_DIA=0 .....) Show quoteHide quote "Benjamin" <Benja***@discussions.microsoft.com> wrote in message news:30A7635C-1CD8-4646-BDCB-7C9DA6B26B11@microsoft.com... > We are using a rowfilter on our dataview and are not getting the expected > results. Our filter is as follows: > > "CLIENT_ID='T1000' AND NOT (RES_RATE=0 AND BP_SIT_SYS=0 AND BP_SIT_DIA=0 > AND PULSE_API=0 AND TEMPERATUR=0 AND WEIGHT_NUT=0)" > > The results we expect are records that have a Client_ID of T1000 and ALL > other data is NOT 0. The logic is pretty simple, we simply don't want to > show records for the client in which ALL information is zero (fields will > never be empty or null, we always make them 0 if no data is entered). > Lets > say PUSLE_API is 90 and everything else is zero, we would then want to > show > that record; just hide all records in which RES_RATE, BP_SIT_SYS, > BP_SIT_DIA, > PULSE_API, TEMPURATUR, and WEIGHT_NUT are ALL zero. > > The problem we are having with this filter is that when it goes to > evaluate > the NOT expression it looks at the first expression in the parenthises and > evaluates the entire expression based on that one part of the expression. > > for example, since RES_RATE is currently first in the expression whenever > RES_RATE is zero it will filter that record, even if every other field has > values in it. So it will only show records in which RES_RATE is not zero. > If we move TEMPERATUR to be first in the NOT expression then it will only > show records in which TEMPERATUR is not zero. > > We have tried using OR instead of AND with a little more success, but > still > having a similar problem. The expression we are using now SHOULD work. > So > why isn't it? Anyone with any ideas/suggestions your input would be > greatly > appreciated. Thanks for the tip; however when I specify NOT before every field it filters
everything and nothing is shown in the datagrid. Show quoteHide quote "Arapi" wrote: > Maybe you can try something like this: > CLIENT_ID='T1000' AND (NOT RES_RATE=0 AND NOT BP_SIT_SYS=0 AND NOT > BP_SIT_DIA=0 .....) > > > "Benjamin" <Benja***@discussions.microsoft.com> wrote in message > news:30A7635C-1CD8-4646-BDCB-7C9DA6B26B11@microsoft.com... > > We are using a rowfilter on our dataview and are not getting the expected > > results. Our filter is as follows: > > > > "CLIENT_ID='T1000' AND NOT (RES_RATE=0 AND BP_SIT_SYS=0 AND BP_SIT_DIA=0 > > AND PULSE_API=0 AND TEMPERATUR=0 AND WEIGHT_NUT=0)" > > > > The results we expect are records that have a Client_ID of T1000 and ALL > > other data is NOT 0. The logic is pretty simple, we simply don't want to > > show records for the client in which ALL information is zero (fields will > > never be empty or null, we always make them 0 if no data is entered). > > Lets > > say PUSLE_API is 90 and everything else is zero, we would then want to > > show > > that record; just hide all records in which RES_RATE, BP_SIT_SYS, > > BP_SIT_DIA, > > PULSE_API, TEMPURATUR, and WEIGHT_NUT are ALL zero. > > > > The problem we are having with this filter is that when it goes to > > evaluate > > the NOT expression it looks at the first expression in the parenthises and > > evaluates the entire expression based on that one part of the expression. > > > > for example, since RES_RATE is currently first in the expression whenever > > RES_RATE is zero it will filter that record, even if every other field has > > values in it. So it will only show records in which RES_RATE is not zero. > > If we move TEMPERATUR to be first in the NOT expression then it will only > > show records in which TEMPERATUR is not zero. > > > > We have tried using OR instead of AND with a little more success, but > > still > > having a similar problem. The expression we are using now SHOULD work. > > So > > why isn't it? Anyone with any ideas/suggestions your input would be > > greatly > > appreciated. > > > I found code that works!!
string filter = "NOT (IsNull("+ Const.RES_RATE + ", 0) = 0 AND IsNull(" + Const.BP_SIT_SYS + ", 0) = 0 AND IsNull(" + Const.BP_SIT_DIA + ", 0) = 0 AND IsNull(" + Const.PULSE_API + ", 0) = 0 AND IsNull(" + Const.TEMPERATUR + ", 0) = 0 AND IsNull(" + Const.WEIGHT_NUT + ", 0) = 0)"; Hope this helps someone else with the same problem. Show quoteHide quote "Benjamin" wrote: > We are using a rowfilter on our dataview and are not getting the expected > results. Our filter is as follows: > > "CLIENT_ID='T1000' AND NOT (RES_RATE=0 AND BP_SIT_SYS=0 AND BP_SIT_DIA=0 > AND PULSE_API=0 AND TEMPERATUR=0 AND WEIGHT_NUT=0)" > > The results we expect are records that have a Client_ID of T1000 and ALL > other data is NOT 0. The logic is pretty simple, we simply don't want to > show records for the client in which ALL information is zero (fields will > never be empty or null, we always make them 0 if no data is entered). Lets > say PUSLE_API is 90 and everything else is zero, we would then want to show > that record; just hide all records in which RES_RATE, BP_SIT_SYS, BP_SIT_DIA, > PULSE_API, TEMPURATUR, and WEIGHT_NUT are ALL zero. > > The problem we are having with this filter is that when it goes to evaluate > the NOT expression it looks at the first expression in the parenthises and > evaluates the entire expression based on that one part of the expression. > > for example, since RES_RATE is currently first in the expression whenever > RES_RATE is zero it will filter that record, even if every other field has > values in it. So it will only show records in which RES_RATE is not zero. > If we move TEMPERATUR to be first in the NOT expression then it will only > show records in which TEMPERATUR is not zero. > > We have tried using OR instead of AND with a little more success, but still > having a similar problem. The expression we are using now SHOULD work. So > why isn't it? Anyone with any ideas/suggestions your input would be greatly > appreciated. This suggests that those columns were nulls not zeros. You could use also <>
operator instead of NOT (..=..) or optionally sum values together and check if the sum is not 0. Peter Show quoteHide quote > string filter = "NOT (IsNull("+ > Const.RES_RATE + ", 0) = 0 AND IsNull(" + > Const.BP_SIT_SYS + ", 0) = 0 AND IsNull(" + > Const.BP_SIT_DIA + ", 0) = 0 AND IsNull(" + > Const.PULSE_API + ", 0) = 0 AND IsNull(" + > Const.TEMPERATUR + ", 0) = 0 AND IsNull(" + > Const.WEIGHT_NUT + ", 0) = 0)";
Other interesting topics
|
|||||||||||||||||||||||