web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

How to get missing date from given date range

(0) ShareShare
ReportReport
Posted on by 141

Hi there,

I am having a dialog with from date and two date dialog fields.

On MyCustom table i am having transaction on the basis of date.

If i am selecting date range of 1/12019 - 31/1/21019 and click on OK button, how can i find out which date record is missing in mycustom table.

How can i achieve it? 

*This post is locked for comments

I have the same question (0)
  • Verified answer
    nmaenpaa Profile Picture
    101,160 Moderator on at

    The exact solution depends on your custom table. What is the field name, data type etc. But let's assume your table has method existsForDate which tells if there is a record for the given date.

    Then your code would look something like this:

    Date fromDate = dialogFieldFromDate.value();
    Date toDate = dialogFieldToDate.value();
    
    while (fromDate <= toDate)
    {
        if (!MyTable::existsForDate(fromDate))
        {  
            info(strFmt("No record for date %1", fromDate));
        }
        fromDate += 1;
    }
  • Maahi P Profile Picture
    141 on at

    Thanks Nikolaos , It worked.

    One more thing i need to ask, 

    i want to search it on the basis of missing date and hcmworkerrecid.

    i have to run my while select on my custom table, and if there is no records then my no loop will be there for that record.

    how  can i fetch missing date under while select? 

  • nmaenpaa Profile Picture
    101,160 Moderator on at

    I don't understand your question. How is the worker rec id related? For sure you can search by date and worker if you want to. Please remember that we know only what you share. So far you haven't shared anything related to worker, but now you ask about it. How could we know?

  • Maahi P Profile Picture
    141 on at

    Hi Nikolaos,

    I have a table with below field.

    WorkerPersonnalNumber, WorkerName, AttendanceDate, Status.

    There will be some missing records in this table for employee who are absent.

    I need to bring the records,  missing date for that employeeID.

    Thanks

  • Verified answer
    nmaenpaa Profile Picture
    101,160 Moderator on at

    Add method existsForEmployeeAndDate in your table, and call it with a date and employee id. Otherwise the code is identical to my previous answer.

    This is how you will get missing dates for an employee. Is it what you were looking for?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans