General Discussion

Tech Talk: Success – The Date (%d) DREL Expression

  • 1.  Tech Talk: Success – The Date (%d) DREL Expression

    Posted 29 days ago

    Our documentation on TrueContext's proprietary language, DREL (Data Record Expression Language), is extensive, and the topic has been frequently discussed within our community. However, DREL is versatile and integral to everything we do, so it warrants continuous attention and review.

    Recent Improvements to the %d Reference

    We've made improvements to the %d reference, which is used to display the date of a form submission. This update affects the date reference, which now returns the date when a record was:

    • Dispatched
    • Declined
    • Submitted (either complete or incomplete)
    • Approved

    Time Zones

    The time zone for dates and times is determined by the following factors:

    1. When Resolving DREL in Output Documents:
      The Document Time Zone Source controls the time zone.
    2. When Resolving DREL in Data Destination or Using the "Test DREL" Option:
      The time zone depends on the record status, as shown below:
    If the record was The date resolves to the
    Dispatched Team time zone (if configured) or UTC (if not)
    Declined, submitted, or transferred, and processed on the server Device time zone
    Approved (Enterprise tier only) Device time zone

    Tip: You can override the default time zones using additional properties found in our DREL Complete Reference List: https://docs.truecontext.com/1374411/Content/Features/DREL/DRELReference.htm?Highlight=DREL%22%20%5Cl%20%22Time.

    Customizing Date Display

    You can customize how the system displays the date. For example, you can:

    • Change the date format: %d[dd/MM/yyyy]
    • Display the day of the week, month, year, or the week of the year: %d[dd-MM-yyyy w]
    • Display and change the time zone: %d[dd-MM-yyyy z][TeamTZ]
    • Use a combination of format properties: %d[dd/MM/yyyy E w z][TeamTZ]

    Date Format Property Details

    • Default Property: [yyyy-MM-dd]
    • Date Format Properties:
      You can modify the date format using the following symbols:
    Symbol Meaning Format supported Output Examples
    y Year [y], [yy], [yyyy] 2019, 19, 2019
    M Month [MM], [MMM], [MMMM] 09, Sep, September
    d Day in the month [d], [dd] 5, 05
    E Day of the week [E], [EEEE] Tue, Tuesday
    D Day in the year [D] 258
    w Week in the year [w] 42
    z Display the time zone [z], [zzzz] EDT, Eastern Daylight Time

    Time Zone Override Properties

    The default time zone may vary depending on the context. For example, you can specify a "default" time zone for a document.

    To display or apply a different time zone, use one of the following properties after a date format:

    • DataRecordTZ: Time zone on the user's device
    • TeamTZ: Time zone configured at the team level
    • Region/City: A specific time zone (any name from the TZ database time zones list)
    Screen capture of the TrueContext form builder, showing the Filename field set to "%f - %d[dd/MM/yyyy E w z][TeamTZ], which results in a value of "Form Name - 28/04/2022 Thu 17 EDT", which overrides the "Document Time Zone Source", which is set to "Form Submission" (the time zone on the user's device).

    Approval Property (Enterprise Tier Only)

    If the record requires approval, use %d[approval] to return the date when the record was last approved. The time zone used is the device time zone of the user who submitted the record.

    Usage Examples

    Here are a few examples of how to use the %d reference:

    • Form submitted:
      %d[dd-MM-yyyy] returns Form submitted 25-06-2020
    • Date in full format:
      %d[EEEE, MMMM d, yyyy] returns Thursday, June 25, 2020
    • Week number:
      %d[w, yyyy] returns Week 26, 2020
    • Date with time zone (TeamTZ):
      %d[dd-MM-yyyy z][TeamTZ] returns 26-06-2020 EDT when the form was submitted on 25-06-2020 at 11:50 PM PDT.
    • Approval date:
      %d[approval][dd-MM-yy] returns Approval date: 30 12 24 when the record was approved on December 30, 2024.

    Additional Resources

    In addition to our Product Documentation, check out these previous community posts on DREL:

    #TechTalkSuccess



    ------------------------------
    David Casal Del Castillo
    Manager, Customer Success
    TrueContext
    Ottawa
    ------------------------------


Reminder: Content posted to our Community is public content.  Please be careful not to post Intellectual Property that you do not have permission to share.  For more information please refer to our Terms Of Use