Difference between Find('-') and FindFirst

chandrurecchandrurec Member Posts: 560
Hi all,

I know that we have to give FindFirst instead of Find('-') for optimisation purpose but actually whats is the difference between Find('-') and FindFirst. I fanyvody know the difference,Kindly reply.

Thanks in advance.

Regards,
chandrurec

Comments

  • icobaniicobani Member Posts: 70
    Find('-') or Find('+') get entire filtered records. FINDFIRST or FINDLAST get only one record.

    You can find bellow code covarage Test
    Customer.RESET;
    Customer.SETRANGE(Customer.City,'BURSA');
    Customer.FIND('-');
    MESSAGE(FORMAT(Customer.COUNT));
    

    SQL with FIND('-')
    SELECT  *,DATALENGTH("Picture") FROM "Tab Gida Sanayi ve Tic_ A_S_$Customer" WITH (READUNCOMMITTED)   WHERE (("City"='BURSA')) ORDER BY "No_"
    


    Customer.RESET;
    Customer.SETRANGE(Customer.City,'BURSA');
    Customer.FINDFIRST;
    MESSAGE(FORMAT(Customer.COUNT));
    

    SQL with FINDFIRST
    SELECT TOP 1 *,DATALENGTH("Picture") FROM "Tab Gida Sanayi ve Tic_ A_S_$Customer" WITH (READUNCOMMITTED)   WHERE (("City"='BURSA')) ORDER BY "No_"
    
    Ibrahim COBANI | Dynamics-NAV Developer Team Manager
    I m a Consult

    E-Mail: ibrahim@imaconsult.com
    My BLOG
  • kinekine Member Posts: 12,562
    chandrurec wrote:
    Hi all,

    I know that we have to give FindFirst instead of Find('-') for optimisation purpose

    But this is only part of the truth. Only if you are not iterating the records this is true. But if you want to use .NEXT on the record, use FINDSET or FIND('-') and NOT FINDFIRST or FINDLAST! Just search this forum for more info... :wink:
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • krikikriki Member, Moderator Posts: 9,115
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Sign In or Register to comment.