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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Data entity Ranges node does nothing in D365

(0) ShareShare
ReportReport
Posted on by 501

Hi;

Testing the Range functionality provided on Data Entities in D365

Scenario: I'm trying to apply a date range to my custom data entity in order to export only the records that were modified yesterday. This will be a recurring export job to daily export only modified records.

Problem: There is a Ranges property that is on Entity level where you can apply ranges to fields in your data entity but seems like it is not working as even a numeric field value range added on it does not filter the results. I am aware of filters available on a functional level as well as ranges available on the datasource level but I want to test out the Ranges on the data entity itself. I also do not see the range applied on SQL level when I see the script of the view for the entity; however they are visible ranges applied on a datasource level.

Question: What is this Ranges node for if not for applying a range to the resultant data set?

7752.range.png

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Martin Dráb Profile Picture
    240,340 Most Valuable Professional on at

    I can't confirm your statement; it works as far as I can say. For example, look at LedgerAccountStructureActiveOnlyEntity, which has a range for Status with value 2, which is also what you can see in the database.

    How did you test the numeric field?

    Note that trying to add a filter for yesterday here makes little sense, because the view is created on synchronization, therefore you would get a date one day before synchronization and that would be fixed until the next synchronization. It wouldn't be the day before the current date.

  • Mohsin Khalid Profile Picture
    501 on at

    Tested it by adding a numeric field on range and setting the value as 234(id of that field), after synchronization checked SQL level view and no range was applied. 

    So the advance query ranges mentioned here only get applied when synchronized? thats strange. I was applying something like (dayRange(-1,0))

    What would you suggest as a good place for this type of range, any entity method we can override to apply ranges on entity export?

  • Suggested answer
    Martin Dráb Profile Picture
    240,340 Most Valuable Professional on at

    Yes, the view gets created on synchronization. That's the purpose of synchronization - it reads object definitions in the application and create corresponding objects (tables, views...) in database.

    When you ask for data of the entity, it simply reads the view from database. And dayRange() is an X++ method; it can't possible be put to T-SQL.

    What you need is including the field which you want to filter (ModifiedDateTime) in the view. Then apply the range when querying the entity, e.g. in an export project or an OData query.

    By the way, have you consider using change tracking instead of filtering ModifiedDateTime?

  • Martin Dráb Profile Picture
    240,340 Most Valuable Professional on at

    I'm sorry, but I don't have enough information to identify what you're doing wrong with the numeric field. It works all right in my environment.

  • Mohsin Khalid Profile Picture
    501 on at

    Thank you for checking, I'll try to create a new one and see if it happens there as well.

    I see, but that would be out of the scope of a recurring data entity job. Isnt there any method inside the data entity to modify the query or datasources? There is a mapDataSourceToEntity() method but that is to transform the result, i wonder if i could somehow use it to filter the record as well.

    I haven't checked change tracking so will do but it seems more of a get then a push on change utility.

  • Martin Dráb Profile Picture
    240,340 Most Valuable Professional on at

    Can you please elaborate what you mean by "that would be out of the scope of a recurring data entity job"?

    I assume you want to use ModifiedDateTime to identify changed records. That's exactly what change tracking is for.

  • Mohsin Khalid Profile Picture
    501 on at

    "What you need is including the field which you want to filter (ModifiedDateTime) in the view. Then apply the range when querying the entity, e.g. in an export project or an OData query."

    I meant it wont be a dynamic range/filter that filters each record by today's date whenever its run cause as far as I checked there is no option to apply a dynamic range on export project level filters. IF that is what you meant, like so:

    rangedate.png

    "I assume you want to use ModifiedDateTime to identify changed records. That's exactly what change tracking is for."

    Yes, however change tracking would require a user to read from the table, it would not push a file to a designated folder of the changed records(which is what im looking to do); correct?

  • Verified answer
    Martin Dráb Profile Picture
    240,340 Most Valuable Professional on at

    Aha, so you want to use data management but you don't know how to add a filter. Create an export project and add an entity. Then find the Filter column and click the funnel icon:

    DMFilter.png

    It will open the usual "advanced filter" form, where you can add you filter.

    This is dynamic; what you tried wouldn't be.

    I have no idea what you're talking about regarding "change tracking would require a user to read from the table"; it doesn't sound like anything about change tracking. I'm talking about increment exports in data management. Let me quote AX documentation:

    Change tracking is a feature that enables incremental export of data from Microsoft Dynamics 365 for Finance and Operations, by using Data management. In an incremental export, only records that have changed are exported. To enable incremental export, you must enable change tracking on entities. If you don't enable change tracking on an entity, you can enable only full export each time.

  • Muhammad Yasir Profile Picture
    1,023 on at

    Hi Mohsin,

    Did u find any way to do that. i exactly have same requirement of adding the range to  modifiedDateTime field of CustTable. If you know. then please share the way how u did that.

    Thanks,

  • Suggested answer
    nmaenpaa Profile Picture
    101,172 Moderator on at

    Enable change tracking for the customer entity in D365 UI (Data entities form), and set incremental push for your data project. You will always get all new and changed customers. Does this meet your business requirement?

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans