BlogPostDate returns as False or Empty

Mike Bilz asked on September 26, 2017 18:53

Hello Kentico Team,

I am attempting to add a "published on" date to my blog post transformation, but for some reason all of my attempts have returned no results.

<%# IfEmpty(Eval("BlogPostDate"), "No BlogPostDate", GetDate("BlogPostDate")) %>

An IfEmpty test like the one above always returns "No BlogPostDate".

I also tried <%# Eval<int>("BlogPostDate") %> and <%# Eval<bool>("BlogPostDate") %> and received "0" and "False" respectively.

BlogPostDate is a required field which does contain content when I view the Form tabs of the Blog Posts themselves. It is also being successfully used within the OrderBy expression of the repeater.

My only guess is that I have a WorkFlow attached to my blog posts which adds a "Pending" step before publication. However, I am not sure how that could be effecting things.

Any assistance you could provide would be greatly appreciated. Thanks in advance.


Correct Answer

Rui Wang answered on September 26, 2017 19:35

Do you have access to the SQL? Can you check the tables to be sure the values are there?

You can use [DocumentCreatedWhen] which would be the page create time. But if you want to create a field to select some other date instead of the page creation date, it should be available as well.

Oh wait, did you specify the columns in the repeater that's pulling the data? Did you add "BlogPostDate" to the columns list?

1 votesVote for this answer Unmark Correct answer

Recent Answers

Rui Wang answered on September 26, 2017 19:08

Does the date show something once you actually publish the blog? With versioning, the date you see in the form before publishing is coming from the version history table, not the blog page type table, so the "BlogPostDate" field in the page type table can still be empty until you publish the blog and that field will be populated for the first time.

0 votesVote for this answer Mark as a Correct answer

Mike Bilz answered on September 26, 2017 19:27

Hi Rui,

No, I have several published blog posts going back a few months and none of them show a "BlogPostDate". I have even attempted to republish some of the blog posts, but this still has no effect on the transformation.

Is there a way to pull the oldest BlogPostDate from the version history? Or to use something like the "Node Created When" field instead?


0 votesVote for this answer Mark as a Correct answer

Mike Bilz answered on September 26, 2017 20:02

Damn. Turns out I didn't add "BlogPostDate" to the columns list.

Always remember to check your columns list.

Thanks for the help, Rui.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.