Search code examples
axaptadynamics-ax-2012x++

Select records 7 days from today


I am trying to select records where a field value (date) is 7 days from today, herefore I am using:

while select TableA where TableA.DateField == systemDateGet() +7

I am going to update some fields with the selected records, 1 of the fields keeps track if the record has been updated through this select statement.

If i would run this script today 26-09, it will select records with the DateField that has 03-10 as their value.

The problem is, if I wouldn't run this script today, but tomorrow, 03-10 will never be selected again, with the result the desired fields won't be updated.

What is the best way to solve this? Is their any way to select a date range for example?


Solution

  • Is their any way to select a date range for example?

    Of course:

    while select TableA
        where TableA.DateField <= systemDateGet() + 7
           && TableA.DateField >= systemDateGet() - 7
    

    1 of the fields keeps track if the record has been updated through this select statement

    Something like this then?

    while select TableA
        where TableA.DateField <= systemDateGet() + 7
           && TableA.HasBeenUpdated == NoYes::No