What does this Find statement exactly do?

GeorgeWaennGeorgeWaenn Member Posts: 4
Hi there,

I'm fairly new to NAV (4.0 SP3) and I came across this snippet of code in codeunit 333:

IF NOT FIND('=><') THEN ...

What does this do? Is it to test if a recordset is empty? I don't quite get it. Hopefully someone can shine some light on this!

Best regards,

George

Comments

  • lvanvugtlvanvugt Member Posts: 774
    You will find this code in all kinds of codeunits, that, one way or another, have to do with posting journal-like records:
    IF NOT FIND('=><') THEN BEGIN
        "Line No." := 0;
        COMMIT;
        EXIT;
      END;
    
    FIND('=><') it is checking whether it can find a specific 'journal' line ('=') or a line after ('>') or a line before ('<').
    So, yes, with the NOT combined the condition evaluates to TRUE when the recordset is empty.
    Luc van Vugt, fluxxus.nl
    Never stop learning
    Van Vugt's dynamiXs
    Dutch Dynamics Community
  • GeorgeWaennGeorgeWaenn Member Posts: 4
    lvanvugt wrote:
    You will find this code in all kinds of codeunits, that, one way or another, have to do with posting journal-like records:
    IF NOT FIND('=><') THEN BEGIN
        "Line No." := 0;
        COMMIT;
        EXIT;
      END;
    
    FIND('=><') it is checking whether it can find a specific 'journal' line ('=') or a line after ('>') or a line before ('<').
    So, yes, with the NOT combined the condition evaluates to TRUE when the recordset is empty.

    Thanks Luc. What's the advantage of the above construction compared to an ISEMPTY?
  • David_SingletonDavid_Singleton Member Posts: 5,479
    This command is outdated, and really does not need to be used.

    Here is a wiki entry about it:

    http://wiki.dynamicsbook.com/index.php?title=Find_any_record_in_a_record_set_in_Dynamics_NAV
    David Singleton
  • GeorgeWaennGeorgeWaenn Member Posts: 4
    Thanks David, that makes things clearer.
Sign In or Register to comment.