FIND vs FINDSET

gulamdastagirgulamdastagir Member Posts: 411
Hi navies,

Plz can anyone tell me the Technical difference between FIND and FINDSET because i dont find FINDSET on C/AL Symbol Menu(F5)

Iam on NAV(4SP1).
Regards,

GD

Comments

  • AlishaAlisha Member Posts: 217
    Ok := Record.FINDSET([ForUpdate][, UpdateKey])
    Use this function to find a set of records in a table based on the current key and filter. The records can only be
    retrieved in ascending order. "ForUpdate": Set this to FALSE if you don't intend to modify any records in the set.
    "ForUpdateKey": If you are going to modify any field value within the current key, set this parameter to TRUE.
  • gulamdastagirgulamdastagir Member Posts: 411
    thanks =D>
    Regards,

    GD
  • DenSterDenSter Member Posts: 8,305
    With FINDSET you have more control over the isolation level of the query when you are writing the code. With FIND you don't have that option.
  • kinekine Member Posts: 12,562
    And is supported from version 4.00SP1, if you are on NAV 4.00 w/o SP, you will not see the commands in the F5 menu. Check the client version in About dialog.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • JoeKJoeK Member Posts: 53
    Findset ist the same as find('-') on the first look, but with findset you have the option to optimize the sql performance for modifing data...

    I made myself a rule:

    - More than 500 records: Find('-')
    - Less than 500 records: Findset

    500 ist the default buffer of recordsets in the sql server....

    edit:

    Parameters for Findset:
    findset(true, false); If you want to modify the records
    findset(true, true); if you want to modify fields of the PK
  • gulamdastagirgulamdastagir Member Posts: 411
    kine wrote:
    And is supported from version 4.00SP1, if you are on NAV 4.00 w/o SP, you will not see the commands in the F5 menu. Check the client version in About dialog.


    About Box says Version W1 4.0 SP1 (4.0)

    and when i press F5->Record->miscellaneous->I dont see FINDSET in the List :shock:
    Regards,

    GD
  • kinekine Member Posts: 12,562
    kine wrote:
    And is supported from version 4.00SP1, if you are on NAV 4.00 w/o SP, you will not see the commands in the F5 menu. Check the client version in About dialog.


    About Box says Version W1 4.0 SP1 (4.0)

    and when i press F5->Record->miscellaneous->I dont see FINDSET in the List :shock:

    Yes, because you are using W1 4.0 SP1 database opened with NAV 4.00 w/o SP... :D
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • DenSterDenSter Member Posts: 8,305
    JoeK wrote:
    Findset ist the same as find('-')
    No that is definately not true. It depends on what you want to do.

    With FINDSET you intend to get a set of records, and with the parameters you can specify what you are going to do with those records.

    FIND('-') is also used to get only the first record, for which you should now use FINDFIRST.

    FIND('-') is also used to check whether records exist at all within the filtered values, for which it is better to use ISEMPTY.
  • MauddibMauddib Member Posts: 269
    I also get the impression from the help file that FINDFIRST is more optimal but only if you intend to FINDFIRST and not USE NEXT.

    However if you intend to do something like IF FIND('-') THEN REPEAT UNTIL NEXT = 0....

    then you should never use FINDFIRST here.

    Have I got that right or am I wrong? I am basing this guess on the help file saying "This function should be used instead of FIND('-') when you only need the first record."
  • DenSterDenSter Member Posts: 8,305
    New commands:
    FINDSET: for getting multiple records, you intend to loop through them
    FINDFIRST: for getting only the first record in the filter, just one record
    FINDLAST: for getting only the last record in the filter, just one record

    When you only want to know if records exist at all, when you don't need any field values from any records, you should use ISEMPTY

    So the key to your question is
    when you only need the first record
  • johannajohanna Member Posts: 369
    DenSter wrote:
    New commands:
    FINDSET: for getting multiple records, you intend to loop through them
    FINDFIRST: for getting only the first record in the filter, just one record
    FINDLAST: for getting only the last record in the filter, just one record

    Hi DenSter,

    I want to ask whether FIND or FIND('=') is same with FINDFIRST?
    If it's different, what is the different?

    Thank you.
    Best regards,

    Johanna
  • BeliasBelias Member Posts: 2,998
    no, they are different:
    if you check the F1 help of nav you will find that
    Finds a record in a C/SIDE table based on the values stored in keys.

    Ok := Record.FIND([Which])

    Parameters
    Record
    Type: Record

    On input, Record identifies the record that you want to find. On output, the following possibilities exist:

    If the record was found, then the record is returned in the Record parameter and any FlowFields in the record are set to zero. You must update the FlowFields using the CALCFIELDS Function (RECORD).

    If the record was not found and if you omitted the return value, a runtime error occurs.

    Which
    Type: Text or code

    Specifies how to perform the search. The table is searched until either a record is found or there are no more records. Each character in this string can be present only once. You can combine the '=', '<', and '>' characters. You can use the following characters:

    = to search for a record that equals the key values (default)
    > to search for a record that is larger than the key values
    < to search for a record that is less than the key values
    + to search for the last record in the table (+ can only be used alone)
    - tosearch for the first record in the table (- can only be used alone)
    If this parameter contains '=', '>' or '<', then you must assign value to all fields of the current and primary keys before you call FIND.
    FIND('=') is more similar to GET function: the difference between those 2 is that GET ignores any filter applied to the set.
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • lyotlyot Member Posts: 202
    DenSter wrote:
    JoeK wrote:
    Findset ist the same as find('-')
    No that is definately not true. It depends on what you want to do.

    With FINDSET you intend to get a set of records, and with the parameters you can specify what you are going to do with those records.

    FIND('-') is also used to get only the first record, for which you should now use FINDFIRST.

    FIND('-') is also used to check whether records exist at all within the filtered values, for which it is better to use ISEMPTY.

    You could also use FIND('-') for multiple records when you use ASCENDING(FALSE), this will not work with a FINDSET.
  • johannajohanna Member Posts: 369
    Belias wrote:
    FIND('=') is more similar to GET function: the difference between those 2 is that GET ignores any filter applied to the set.

    Thank you for the information, Belias :D
    Best regards,

    Johanna
  • sbansalsbansal Member Posts: 17
    FINDSET(FALSE,FALSE)- read-only. This uses no server cursors and the record set is read with a single server call.

    FINDSET(TRUE,FALSE) - This is used to update non-key fields. This uses a cursor with a fetch buffer similar to FIND(‘-’).

    FINDSET(TRUE,TRUE) - This is used to update key fields.
Sign In or Register to comment.