Select to view content in your preferred language

Date/time field values not displaying in Dynamic Content

311
2
Jump to solution
07-23-2024 12:19 PM
Labels (1)
fdeters
New Contributor III

I'm running into an issue with using date/time fields in Dynamic Content in Text widgets in AGOL Experience Builder: When I use any date/time field as the source for a Dynamic Content value, the value does not display.

I know the values are there, because they show in popups and I can successfully use them to sort a List widget connected to the data. So I end up with a situation where there is a List widget with Text in the list item, both widgets are connected to the same data source, the List is sorted using a date/time field, and that same field does not show up when I use it as dynamic content in the Text widget.

This same issue is happening for every date/time field in the layer, as far as I can tell.

I saw a lot of posts about date/time values showing up without the time portion (not the problem I'm having), which was usually fixed by editing the layer's Field settings in a web map. I've checked the Field settings for multiple date/time fields in this layer, and they seem to be okay.

Bonus clue: I get this error in the browser console: 

fdeters_0-1721762060191.png

Has anyone else experienced this? Any suggested fixes?

0 Kudos
1 Solution

Accepted Solutions
fdeters
New Contributor III

Hi @Ke_Xu, I found the issue! It was indeed related to the Field settings on the layer(s) I was having problems with. Here's what I did:

TL;DR Experience Builder Text widget needs to add a fallback default date/time format to apply to date/time fields when a field doesn't have a `format` explicitly defined.

  1. I dug through the stack trace for the `Invalid data format undefined` error from the screenshot in my post, and realized that the function responsible for displaying the data in the correct format was being passed `undefined` as the format key, which obviously is not a known `ESRI_DATE_FORMAT_MAP` key. fdeters_0-1721943022702.png

     

  2. I realized this must mean there is somewhere in the layer where Experience Builder is looking for a date format and isn't finding one. (I think this is a real problem - there should be fallback behavior when it can't find a date format, not just a blank display.) So, I went to the Visualization tab on the Item Details page in AGOL for the Feature Layer I'm working with, and changed both the date and time format settings to a random option, then back to the default so that it would hopefully record it as a custom setting. fdeters_1-1721943245960.png

     

  3. Then, I saved the changes to the Feature Layer, and I saw this new `format` key show up in the JSON for that field in the Feature Layer (the `format` key was not there before I did step #2): fdeters_4-1721943371389.png
  4. This worked! I can now see the date in the Text widget in my Experience: fdeters_5-1721943500318.png

 

Edit: I also had to make the same changes to the Field date format settings in the Web Map I'm using the Feature Layer in for the date to show up in the EB Text Widget.

View solution in original post

2 Replies
Ke_Xu
by Esri Contributor
Esri Contributor

Hi fdeters,

I couldn't reproduce this issue. Could you share an App for us to troubleshoot this issue?

Ke_Xu_0-1721815139118.png

 

Thanks,

Ke

 

 

0 Kudos
fdeters
New Contributor III

Hi @Ke_Xu, I found the issue! It was indeed related to the Field settings on the layer(s) I was having problems with. Here's what I did:

TL;DR Experience Builder Text widget needs to add a fallback default date/time format to apply to date/time fields when a field doesn't have a `format` explicitly defined.

  1. I dug through the stack trace for the `Invalid data format undefined` error from the screenshot in my post, and realized that the function responsible for displaying the data in the correct format was being passed `undefined` as the format key, which obviously is not a known `ESRI_DATE_FORMAT_MAP` key. fdeters_0-1721943022702.png

     

  2. I realized this must mean there is somewhere in the layer where Experience Builder is looking for a date format and isn't finding one. (I think this is a real problem - there should be fallback behavior when it can't find a date format, not just a blank display.) So, I went to the Visualization tab on the Item Details page in AGOL for the Feature Layer I'm working with, and changed both the date and time format settings to a random option, then back to the default so that it would hopefully record it as a custom setting. fdeters_1-1721943245960.png

     

  3. Then, I saved the changes to the Feature Layer, and I saw this new `format` key show up in the JSON for that field in the Feature Layer (the `format` key was not there before I did step #2): fdeters_4-1721943371389.png
  4. This worked! I can now see the date in the Text widget in my Experience: fdeters_5-1721943500318.png

 

Edit: I also had to make the same changes to the Field date format settings in the Web Map I'm using the Feature Layer in for the date to show up in the EB Text Widget.