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!
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!
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).
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.
Great Martin!
It worked! Thanks!
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()).
André Arnaud de Cal...
292,884
Super User 2025 Season 1
Martin Dráb
231,758
Most Valuable Professional
nmaenpaa
101,156
Moderator