delete the value in a column where date is before 30

Hi,

I have one table ‘Transaction header’.

I need code that will delete all entries in this table where the date is earlier than 30 days ( as compared to current date).

ex:

SQL code looks like this.

delete * frm Transaction Header

where Date < (GETDATE()-30)

.

Any body help me on how can I write in Navision code ?

Chekc CALCDATE function in NAV.

Using CALCDATE calculate 30 days backwards from today

Check whether the calculated date is greater than date in your table.

if not, delete…

Please dont expect complete code from forum.

first try yourself and if it didnt work then let us know.

Hi Mohana,

Okay, I may need to spend more time on it.

I am doing self learning, and as a starter, after you commented i am searching where can I get CALCDATE function.

still researching for that :wink: I will reply after I found it.

Teeyech.

Here is the help link

http://msdn.microsoft.com/en-us/library/dd301368.aspx

Hi,

That link helped me. And, I am already using microsoft for the help along with this.

and here, I used today-30. growing up [;)].

And, may I know where I need to refer to know about sorting a table.

I need to sort a table ‘transaction header’ by taking ‘receipt number’ DESC >> and then I need to delete all by leaving the first raw -

there by I could skip the last receipt.

Regards,

Teeyech

Now what is the problem ???

You need to create keys in the table for sorting & use the setcurrentkey in you code.

Hi all,

that is done now. I found another way for it.

Thank you all.

Regards,

Teeyech