Is there any way to filter out records from a table when the value of say field1=field2 . Can i set any filter in the OnOpenform of a form?records with field1=field2 should not be shown.I dont want to read all the records and check this condition. Can any filtering be done?
Setfilter("field1",'<>%1',5) possible
setfilter("field1",'<>%1',"field2") not possible.
Please advise
0
Comments
add new field to the table, which will be True if fields are same, and refresh this field each time the fields are changed (OnValidate, OnModify or somewhere else).
You can add FlowField with definition like:
Exists record with same primary key where FIELD1 = FIELD2?
After that, you can filter to this, but "YOU ARE FILTERING ON FLOFIELD" and it means that performance will be not good and can have impact to other processes...
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
this is not working (and I don't know a way to let it work ) because:
-if you are not looping in "rec", "field2" has no value
-if you are loopin in "rec"...well...the code is nonsense
BTW, i'm afraid you have to loop the entire table and test, mark...and then show markedonly, also you can use temptables, which is better if you're on SQL...
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
first and second you need an new Field in your table.
1. create an new field (bool) and set it true in all your codes where you modify this table) if field 1 = field 2
2. create an new field (bool) as Flowfield (exist Table field 1 = field 2) (but filtering of an calculated field is #-o
3. in you code you can "filter" with an loop
repeat
if not (field 1 = field 2) then begin
her you can store the records or mar or what else
end;
until rec.next = 0;
The reason, why you can't do filter the values (in SQL you can) is, navision must ever know the filtered values to filter. In SQl the Server runs through the recs and checked than (like a loop)