14 Nov 2025
09:06 PM
- last edited on
17 Nov 2025
01:09 PM
by
MaciejNeumann
I want to have a DQL query to calculate expiry date for a creation date to be expired in 90 days. However, the date value is raw, e.g. 2025-02-10T20:45:00.000+0000.
I tried using a simple calculation like TokenExpiryDate = CreatedDate + duration(90, "d") but displays as null. If I use timestamp, e.g. timestampy(CreatedDate), it gives me error. Can someone please share what else is missing? Tried asking copilot but not too helpful.
17 Nov 2025 10:25 AM
Hi,
In DQL you can’t use a field that you just created in the same fieldsAdd.
Your DQL
will give: The field CreatedTs doesn't exist, because TokenExpiryDate can’t “see” CreatedTs yet.
Try this way:
data record(CreatedDate = "2025-02-10T20:45:00.000+0000")
| fieldsAdd CreatedTs = toTimestamp(CreatedDate)
| fieldsAdd TokenExpiryDate = CreatedTs + duration(90, "d")Use two fieldsAdd steps or compute it directly.