It means to find a record
1) '=' that has the same primary key (it is like a get)
2) if 1) doesn't find anything, it searches a record that comes after current record, using the current key
3) if 2) doesn't find anything, it searches a record that comes before current record, using the current key
I never used a find with all 3 characters in it.
Regards,Alain Krikilion No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
You don't want to use that, it is 3 table scans in one command, and it is one of the most idiotic statements in C/AL. It is one of the things to look for when you run into performance problems. FIND('-') (or FINDSET or FINDFIRST, whichever you need) should be enough.
Hi
It could be used only in native db. In earler versions it was only statements looks for ANY record in table and it was fastest. Now we have "isempty".
Never use it in SQL as denster said.
And we don't need it now
Don't Know how isempty relates to find nearest, as an example a variant of this code is used in the find date functions (PeriodFormManagement) in Navision, if you are looking for a period relating to a selected date, within the period, Navision uses this code to Find the nearest Match, IE: Date Type::Month, and input a Starting Date of 10/10/06, FIND('=<>') will return the record for the 10th Month, 1st Oct - 31st Oct 2006.
So it is not redundant and has a good use in the Navision World! :?
Maybe this explains a use and is the answer zakret wanted?
Note: '=><' would have returned November in the example, Equal to, Greater Than then Less Than:
Hi,
1.
Part from Application designer guide page 625:
...
Providing the ISEMPTY Alternative to FIND
The new ISEMPTY function utilizes an existing driver function and allows a less expensive, non-cursor, SQL statement to be used for determining whether or not a filtered set is empty. [-X
...
2. FIND('=<>') generates the SAME 'select' in SQL as FIND('-'), so we have no differences between FIND('=<>') and FIND('-').
FIND('+') add DESC in the 'select' (changes returned recordset order). FIND('=') add statement WHERE by keys values to 'select'. :-$
3. Maybe FIND('=<>') could be used, but i didn't any see reasons. How it could return nearest in SQL?? :?:
Not exactly, because when you replace it with IF ISEMPTY, then your card form will be empty, and the list form on F5 will be empty as well. So the two are not the same.
Not exactly, because when you replace it with IF ISEMPTY, then your card form will be empty, and the list form on F5 will be empty as well. So the two are not the same.
it's a bit confusing when you talk about forms..... because ISEMPTY and FIND are both Record-Functions....
hmm... sorry guys if my post was a bit misleading, but I didn't ask anything... or was there a question mark?
all I tried to explain is.. when somebody writes (as the topic starter did)
IF NOT FIND('=><') THEN
Call_A_MethodToFillInSomeBasicData
....
Then I expect that the developer wants to do something ONLY when there arent any records in the table or the filtered range.... same as
IF ISEMPTY THEN
Call_A_MethodToFillInSomeBasicData
These are not the same, FIND will Return a Record if one exists within the filters, and ISEMPTY Just returns a boolean check as to if records exist within the filters, I have not used ISEMPTY but I assume it is used the same way we use the COUNT or COUNTAPPROX in the Native
IF MyRec.COUNTAPPROX <> 0 THEN
MyRec.FIND('-');
IF NOT MyRec.ISEMPTY THEN
MyRec.FINDFIRST;
I think ISEMPTY is really for SQL as COUNTAPPROX returns 1 for an empty recordset in SQL and Causes an Error.
Again... that depends on what you want to do.... FIND will return a record if there is one, ISEMPTY will return a boolean. Use as needed.
In the OnFinRecord form trigger, you cannot replace FIND('=><') with ISEMPTY. I have tried and it does not behave the same way. ISEMPTY IS NOT a replacement for FIND(Which) when Which equals '=><'.
Leave the code as it is. The way its supposed to work is making a find in the filtered recordset. If you think about what happens when you find the last record(ctrl+end) it makes perfect sense and cannot be replaced by a boolean(isempty) since that wont get you the last record.
If you are in doubt you can always try to check the c7side reference guide(F1) look under onfindrecord.
I was just curious as its used in parts of standard Navision but as Gedas says it produces exactly the same SQL statement as a FIND('-') so I was unsure if it had a purpose or whether it was left over code from native navision.
Interesting what David Cox has said about dates - I will keep that in the back of my head for now, it could come in handy in the future.
Comments
1) '=' that has the same primary key (it is like a get)
2) if 1) doesn't find anything, it searches a record that comes after current record, using the current key
3) if 2) doesn't find anything, it searches a record that comes before current record, using the current key
I never used a find with all 3 characters in it.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
RIS Plus, LLC
It could be used only in native db. In earler versions it was only statements looks for ANY record in table and it was fastest. Now we have "isempty".
Never use it in SQL as denster said.
And we don't need it now
So it is not redundant and has a good use in the Navision World! :?
Maybe this explains a use and is the answer zakret wanted?
Note: '=><' would have returned November in the example, Equal to, Greater Than then Less Than:
Kriki's answer being the correct one.
Mobile: +44(0)7854 842801
Email: david.cox@adeptris.com
Twitter: https://twitter.com/Adeptris
Website: http://www.adeptris.com
when you look at some Forms (5050,41,42,43,etc.) you'll find something like
place a breakpoint and you'll see that the variable 'Which' has the value '=><' when you open the form, delete a record, post an order, etc...
but checks if no records can be found
Mobile: +44(0)7854 842801
Email: david.cox@adeptris.com
Twitter: https://twitter.com/Adeptris
Website: http://www.adeptris.com
1.
Part from Application designer guide page 625:
...
Providing the ISEMPTY Alternative to FIND
The new ISEMPTY function utilizes an existing driver function and allows a less expensive, non-cursor, SQL statement to be used for determining whether or not a filtered set is empty. [-X
...
2. FIND('=<>') generates the SAME 'select' in SQL as FIND('-'), so we have no differences between FIND('=<>') and FIND('-').
FIND('+') add DESC in the 'select' (changes returned recordset order). FIND('=') add statement WHERE by keys values to 'select'. :-$
3. Maybe FIND('=<>') could be used, but i didn't any see reasons. How it could return nearest in SQL?? :?:
RIS Plus, LLC
it's a bit confusing when you talk about forms..... because ISEMPTY and FIND are both Record-Functions....
Simple - Sample with Codeunit
Customer.SETRANGE("No.",'10000'); // --->Customer exists
MESSAGE(FORMAT(Customer.ISEMPTY)); // ----> False
MESSAGE(FORMAT(NOT Customer.FIND('=><'))); // ---->False
Customer.SETRANGE("No.",'10000X'); // --->Customer doesn't exist
MESSAGE(FORMAT(Customer.ISEMPTY)); // ----> True
MESSAGE(FORMAT(NOT Customer.FIND('=><'))); //---->True
So, same results... or am I still wrong??
The two functions ARE NOT interchangeable. They are used for different reasons.
RIS Plus, LLC
all I tried to explain is.. when somebody writes (as the topic starter did)
Then I expect that the developer wants to do something ONLY when there arent any records in the table or the filtered range.... same as
of course ISEMPTY is the better way of coding
IF MyRec.COUNTAPPROX <> 0 THEN
MyRec.FIND('-');
IF NOT MyRec.ISEMPTY THEN
MyRec.FINDFIRST;
I think ISEMPTY is really for SQL as COUNTAPPROX returns 1 for an empty recordset in SQL and Causes an Error.
Mobile: +44(0)7854 842801
Email: david.cox@adeptris.com
Twitter: https://twitter.com/Adeptris
Website: http://www.adeptris.com
In the OnFinRecord form trigger, you cannot replace FIND('=><') with ISEMPTY. I have tried and it does not behave the same way. ISEMPTY IS NOT a replacement for FIND(Which) when Which equals '=><'.
RIS Plus, LLC
If you are in doubt you can always try to check the c7side reference guide(F1) look under onfindrecord.
I was just curious as its used in parts of standard Navision but as Gedas says it produces exactly the same SQL statement as a FIND('-') so I was unsure if it had a purpose or whether it was left over code from native navision.
Interesting what David Cox has said about dates - I will keep that in the back of my head for now, it could come in handy in the future.