how I can the date of days after ?

hi

I have to known how I can known the next days for exemple :

i have the delivery date in AX every one day of week exemple : the employee select new york every monday I do the delivery of product ; but ht developper don’t known what the employee select he must comper the day of today with the date of delivery in new york but if i have an order in tuesday the next delivery is in the next monday

how I can have the date of the next delivery dynamicly ?

thank you

Hello Hakim,

You can use dates in additions and subtractions when you are using the date as the principal type; that is, if you are subtracting from or adding to a date, like this:

date = date - integer or date = date + integer

Dates are not automatically converted into other types, but you can use integer values in the computation of dates. For example:

void myMethod()

{

int anInteger;

date aDate;

;

// Sets the date variable adate to January 1, 1998

aDate = 1\1\1998;

// Sets the integer variable anInteger to 30.

anInteger = 30;

// Sets aDate to aDate + 30; that is the 31st of January 1998

aDate = aDate + anInteger;

print aDate;

pause;

}

The date printed will be 31\1\1998.

So to compute the delieverydate you’ll have to use the following expression:

delieverydate = orderdate + 6;

I known that thank you but supose that I don’t known the day where I want compare my delivery exemple

today is 15/08/2011 and the day that i want to compare is sunday but so the delivery is in the next sunday ok

but for me the day of comparison is unknown to me, I even make a code to detect the days on which I need to compare and add value at the date today dynamicly?

thank you

hi

this is what I want :

plan plan;

int k,j1,j2,j3,td;

int adddate;

str today;

;

k = 0;
while select hal_days from plan where plan.hal_sect == sect1
{

day = enum2int(plan.hal_days);
if (k == 0)
{
j1=day;

}
else{

if(k == 1 )
{
j2 = day;

}
else{
j3 = day;

}
}

k++;

}
td = (dayofwk(systemdateget()));
theday= dayname(td);

adddate = 0;
if ((td == j1) || (td == j2) || (td == j3))
{
td++;
adddate++;

}

while ((td != j1) && (td != j2) && (td != j3))
{
adddate++;
if ( td == 7 )
{
td = 1;

}
else{
td++;

}

dj = systemdateget() + adddate;

ttsbegin;
select forupdate salesTable where salestable.SalesId == sid;
{
salestable.hal_dateliv=dj;
salestable.update();

}
ttscommit;

}