ListPage Fields

5 posts by 3 authors in: Forums > CMS Builder
Last Post: August 10, 2023   (RSS)

By mabsi - August 6, 2023 - edited: August 7, 2023

Hello

How to display number of days from creation date till today in the ListPage Fields 

Like below example:

Record No.      Creation Date     No. of Days
-------------------------------------------------------------------

     1                   2023-08-01              5

No. of Days=   NOW() - Creation date 

By robin - August 7, 2023

Hi Mabsi,

Looks like you want to do this in sql?  Check out the mysql DATEDIFF function.  Something like
https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_datediff

DATEDIFF(NOW(), createdDate);

Hope that helps!  Thanks,
Robin

Robin
Programmer
interactivetools.com

By Dave - August 9, 2023

Hi Mabsi, 

Unfortunately, there's no automatic way to do that.  

If you have some experience with PHP programming you could write a plugin to do it.  Some of CMS Builder internals are actually written as plugins.  So if you look at this file: cmsb/lib/menus/_outgoing_mail/actionHandler.php you can see how _ogm_cmsList_messageColumn() outputs custom content for a column.

You can also have a look at a sample plugin in the plugin folder here: cmsb/plugins/samplePlugin.php

Hope that helps!

Dave Edis - Senior Developer
interactivetools.com

By mabsi - August 10, 2023

Thank you Dave for your reply.

I will try and post here the solution