Join our Community in its new Home - The Datorama Trailblazer Community Group!

It's been an amazing 3 years coming together in this forum to collaborate, innovate, support, and inspire each other about our shared usage of Datorama. While this is not quite a goodbye, we are excited to announce that we are getting a fresh start in our new home within the Salesforce Trailblazer Community. We have a ton of fun new content planned and you may even see the revival of some of our most popular posts from the past few years.

We’ll be keeping this group around for a bit for you to peruse, but as of November 15, we will no longer be allowing new posts or comments. Be sure to join our new group at https://www.salesforce.com/success-datorama to keep the conversation going.

We can’t wait to see you there!

Text dimensions to Date dimensions?

tsvete_gtsvete_g London, UKSYS_ADMIN IMG42
edited February 2019 in Help Center

Have you ever needed to map a Date type csv field to an Attribute?

Have you had to deal with the fact that Attributes are actually Text type dimensions and not Date dimensions?

Then you probably had to manually change dimension types from Text to Date.

When dimensions have their type changed manually from Text to Date though, they tend to misbehave and return rather unexpected results, such as this one:

Luckily, we have a simple solution that can help you deal with this blast from the past.

Non-Date dimensions that were changed to Date can only accept one date format which is the default format in the platform.

To get the default format you can use the FORMATDATE_DEFAULT() formula in the mapping. Make sure that the element you insert in this formula is a Date type element. In case it isn’t, you can use PARSEDATE() along with the FORMATDATE_DEFAULT() formula.

For the dimensions in the above example, we used the following formulas:

FORMATDATE_DEFAULT(PARSEDATE(csv['due_at'],'EEE MMM dd hh:mm:ss Z yyyy'))
FORMATDATE_DEFAULT(PARSEDATE(csv['completed_at'],'EEE MMM dd hh:mm:ss Z yyyy'))

Once we applied them, we were able to display the correct results:

Now you know how to turn text dimensions into date dimensions like a boss!

Let us know if you have any questions. :)

Comments

  • JohnKoonsmanJohnKoonsman IndianapolisSYS_ADMIN IMG42
    When I try above and try to Code Validate, I get: Malformed expression
    Failed to evaluate expression due to a runtime error. Error details: ReferenceError: csv is not defined. Error originating from expression: csv

    FORMATDATE_DEFAULT(PARSEDATE(csv['Day'],'EEE MMM dd hh:mm:ss Z yyyy'))

    Any help greatly appreciated.

Sign In or Register to comment.