Difference between Find('-') and FindFirst

chandrurecchandrurec Posts: 549Member
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 Posts: 70Member
    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: [email protected]
    My BLOG
  • kinekine Posts: 12,560Member
    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 Posts: 8,570Member, Moderator
    Regards,Alain Krikilion
    Use the SEARCH,Luke! || No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
    NAV TechDays 2018: 22 & 23 November 2018, Antwerp (Belgium)
Sign In or Register to comment.