Notifications
Announcements
No record found.
Hi all,
I need to get Physical date from a query in a form to calculate the date difference. Basictly I want to get the 01-11-2020 (or full text >01-11-2020) value. How can I do it to show the value in a display method? Thanks!
use queryFilter
community.dynamics.com/.../170494
It may be simple - you just need to find the range and call its value() method. For example:
str value; QueryBuildRange range = qbds.findRange(fieldNum(InventTrans, DatePhysical)); if (range) { value = range.value(); }
It becames more complicated if there can be more ranges for the same field. Also, query values may contain more things than just a single value, e.g. date ranges or methods like (day()).
Great Martin!
It worked! Thanks!
Hi Martin,
I know that the question was answer, but is it possible to find by range name? In this case I added two DatePhysical field, but one is the start date and the other is end date.
I don't remember ever seeing any code working with a range name, nevertheless you surely could iterate ranges for a field and check their name(). Nevertheless you would have to hard-code the range name in your code, which isn't a good practice.
Also, why do you need two ranges? Can't you simply use a single range with an inteval (e.g. "DatePhysical is between start date and end date")?
Note that the whole idea of getting a value from range, converting it back to a date and working with it looks suspicious to me. As I mentioned before, it's not even always possible (because the value may be a list, an interval, a method or another expression).
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Martin Dráb 565 Most Valuable Professional
André Arnaud de Cal... 450 Super User 2025 Season 2
Sohaib Cheema 250 User Group Leader