Skip to Content
author's profile photo Former Member
Former Member

Find last record

Hi,

I need to know the DocNum last value of the table OINV.

How can I do it?

Thanks in advance,

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Feb 27, 2009 at 09:00 AM

    Hi

    just fire this query

    Select Max(DocNum) from OINV

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hello Christina,

      if such a query is what you are looking for I would write:

      SELECT

      TOP 1 DocNum

      FROM [OINV]

      ORDER BY CreateDate DESC

      or maybe with DocDate if the last invoice by DocDate is needed:

      SELECT

      TOP 1 DocNum

      FROM [OINV]

      ORDER BY DocDate DESC

      Hello Hepil Doshi,

      I fear your query does not work when Document Numbering Series are used.

      Cheers,

      Roland

  • author's profile photo Former Member
    Former Member
    Posted on Feb 27, 2009 at 09:07 AM

    Thank you for you answer, but I want to know if exist some API function which get this value.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 27, 2009 at 11:11 AM

    Thanks to everybody!!!!

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.