use of FIND('=><')

GoMaDGoMaD Member Posts: 313
Hi all,

just a quick question:

what's the use of a find with the following syntax

FIND('=><')

cfr codeunit 23
Now, let's see what we can see.
...
Everybody on-line.
...
Looking good!

Comments

  • jmjm Member Posts: 156
    Hi,

    FIND('=><')

    is like first: FIND('=') => Find equal,
    if not found: FIND('>') => Search for next (upwards),
    if not found: FIND('<') => Search for next (downwards)

    br
    Josef Metz
    br
    Josef Metz
  • GoMaDGoMaD Member Posts: 313
    Thanks,

    Personaly I think this should be in the F1 (Help) function, don't you think?

    Regards,
    Now, let's see what we can see.
    ...
    Everybody on-line.
    ...
    Looking good!
  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
  • DenSterDenSter Member Posts: 8,307
    What do you mean *should be*.... it IS in F1 help. Go to thesearch tab and search for FIND, and you will see it.
    GoMaD wrote:
    Thanks,

    Personaly I think this should be in the F1 (Help) function, don't you think?

    Regards,
  • jmjm Member Posts: 156
    GoMaD wrote:
    Thanks,

    Personaly I think this should be in the F1 (Help) function, don't you think?

    Regards,

    it is in the Online Help:
    FIND (Record)
    Use this function to find a record in a C/SIDE table based on the values stored in keys.
    
    Ok := Record.FIND([Which])
    ...
    
    ...
    Which
    
    Data type: text or code
    
    Tells the system how to perform the search. The system searches through the table until either it finds the record or there are no more records. Each character in this string can be present only once. You can combine the '=', '<' and '>' characters.
    
    This...      Tells the system to search for...
     
    '='      A record that equals the key values (default)
     
    '>'      A record that is larger than the key values
     
    '<'      A record that is less the key values
    ...
    
    br
    Josef Metz
    br
    Josef Metz
  • GoMaDGoMaD Member Posts: 313
    ok, find is in the help function, duh

    but the meaning of a find string like '=<>' isn't explained.
    It says that each character can be used once and can be combined,
    but how navision treats this SearchString isn't mentioned.

    Correct me if i'm wrong but it the following quote doesn't explain that the SearchString is parsed as JM replied on my post:
    FIND (Record)
    Use this function to find a record in a C/SIDE table based on the values stored in keys.

    Ok := Record.FIND([Which])
    Ok

    Data type: boolean

    If you omit this optional return value, a run-time error occurs if the system cannot find the record. If you include a return value, the system assumes you will handle any errors. Ok can have these values:

    If Ok is...
    It means the record was...

    TRUE
    Found

    FALSE
    Not found


    Record

    Data type: record

    On input, Record identifies the record you want the system to find. On output, there are two possibilities:

    If the record was...
    Then...

    Found
    The system returns the record in Record and sets any FlowField in the record to zero. You must update them using CALCFIELDS.

    Not found
    A run-time error occurs, if you omitted the return value Ok.


    Which

    Data type: text or code

    Tells the system how to perform the search. The system searches through the table until either it finds the record or there are no more records. Each character in this string can be present only once. You can combine the '=', '<' and '>' characters.

    This...
    Tells the system to search for...

    '='
    A record that equals the key values (default)

    '>'
    A record that is larger than the key values

    '<'
    A record that is less the key values

    '+'
    The last record in the table ('+' can only be used alone)

    '-'
    The first record in the table ('-' can only be used alone)


    If SearchStr contains '=', '>' or '<', you must assign values to all fields of the current and primary keys before you call FIND.

    Comments
    FIND retrieves the first record that meets the conditions set by SearchStr and the filters associated with Record. The search path reflects the sort order defined by the current key. If the current key is not the primary key, there is a chance that several records might have the same values in current key fields. If this happens, the system uses the sort order defined by the primary key as the search path.

    Example
    This C/AL code shows how to use the FIND function:

    dialog.OPEN('Search for customer number...\'
    + '#1##################');
    dialog.INPUT(1, Customer."No.");

    IF Customer.FIND THEN
    MESSAGE(Text000 + Text001, Customer."No.", Customer.Name)

    ELSE
    MESSAGE(Text002);

    Create the following text constants in the C/AL Globals window:

    Text Constant
    ENU Value

    Text000
    'The customer was found.\'

    Text001
    'Customer No. %1 is:\%2'

    Text002
    'Sorry, that customer could not be found...'


    First, the system prompts you to enter a customer number to search for:

    Search for customer number...

    If the number you enter does not exist, the system displays this message:

    Sorry, that customer could not be found...

    If the system finds the number in the Customer table, it could display:

    The customer was found.
    Customer number AAA 1050 is:
    AAA Furniture Manufacturing
    Now, let's see what we can see.
    ...
    Everybody on-line.
    ...
    Looking good!
  • jmjm Member Posts: 156
    GoMaD wrote:
    Thanks,

    Personaly I think this should be in the F1 (Help) function, don't you think?

    Regards,

    You can go to https://mbs.microsoft.com/partnersource/productsuggestion and make a product suggestion.

    br
    Josef Metz
    br
    Josef Metz
  • KowaKowa Member Posts: 925
    GoMaD wrote:
    but the meaning of a find string like '=<>' isn't explained.
    It is a 3-step Find in the order stated.
    It means first try to find a record that is equal, if not successful try to find one that is smaller, if still not successful try to find one that is larger than the key values.
    Kai Kowalewski
Sign In or Register to comment.