After setting a filter and a findset you could do a get too with the same recordset.
How does the FINDSET help?
GET ignores filters.
jordi79's solution only works if "No." is the entire primary key and a record with the value you want to test actually exists. In any other scenario you need to insert appropriate test data into a (temporary) table in order to only test that filter/value pair.
If you want to perform a filter within a filter that does not belong to a primary key fields, then you should use "filtergroup" functions. Read the documentation about how it works. But in short it allows some sort of filter "isolation". So that you can filter within a filtered record without removing the earlier filter.
SomeTableTEMP.RESET;
SomeTableTEMP.DELETEALL(FALSE);
CLEAR(SomeTableTEMP);
SomeTableTEMP."Field X" := '1010';
SomeTableTEMP.INSERT(FALSE);
SomeTableTEMP.RESET;
SomeTableTEMP.SETFILTER("Field X", '1000..2000');
IF NOT SomeTableTEMP.ISEMPTY THEN
// found!!!
ELSE
// NOT found!!!
But be careful with it because SQL Server sorts code-fields differently than native DB (1,2,10 in native becomes 1,10,2 in SQL). And temptables use the native DB sorting. From NAV2013 this should be fixed.
Regards,Alain Krikilion No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
Answers
Rec."no." := '1010';
if rec.find('=') then
// record found!!!
else
// record not found!!!
I needed this the first time :oops:
With kind regards
mik
GET ignores filters.
jordi79's solution only works if "No." is the entire primary key and a record with the value you want to test actually exists. In any other scenario you need to insert appropriate test data into a (temporary) table in order to only test that filter/value pair.
But be careful with it because SQL Server sorts code-fields differently than native DB (1,2,10 in native becomes 1,10,2 in SQL). And temptables use the native DB sorting. From NAV2013 this should be fixed.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!