Repeating Panel Label not binding to Date field in Data Table

Hi, I’ve set up 4 repeating panels on a column panel to bind to 4 fields from a Data Table.

The first 3 repeating panel labels are binding to ‘text’ aka string Data Table fields just fine, but the 4th is supposed to bind to a ‘date’ field and it’s not displaying the data, but its not throwing an error either.


If you look at the difference between the 2 screenshots, you’ll see that the editor thinks the ‘date_created’ field is a ‘undefined’ column type, when I’ve already set it up as a ‘date and time’ field in the Data Table. Note: the ‘date_removed’ is a ‘Date’ field, which also is displaying as an ‘undefined’ Column type.

Any ideas what’s happening here and how I can get my date field to display? Could I create another column in the Data Table that creates a string from the date field and bind that string date column instead?

Thanks for your help!

Sort of - see cloned project - if you change the binding in the ItemTemplate form to this :

str(self.item['datetime'])

it displays fine as a workaround.

Nice suggestion @david.wylie, worked perfectly! Even sliced the string a bit to make the datetime look pretty!

1 Like

Hey,

The reason it’s not displaying as you wanted is that what you’re displaying is a datetime object, and what the text property wants is a string. The good news is that every data binding is a proper Python expression! This means you can do simple things (like calling str() to turn the datetime into a string), or more complex things, like calling strftime to format the date. For example:

self.item['datetime'].strftime('%H:%M on %b %d, %Y')

which will display ‘12:04 on Dec 26, 2017’

You can find a guide to strftime() http://strftime.org/.

4 Likes