Skip to Content Skip to Menu

Field Groups and dates

  • rbuelund
  • rbuelund
  • OFFLINE
  • Posts: 565
  • Thanks: 40
  • Karma: 4
3 years 11 months ago - 3 years 11 months ago #321320 by rbuelund
Replied by rbuelund on topic Field Groups and dates
Sorry there! You are absolutely correct. My host uses PHP-version: 5.4.16 on the server that runs phpmyadmin - they are looking into the problem tomorrow - thank you!

But until then - would this Advanced filter be possible to use ?: WEEK(STR_TO_DATE(JSON_EXTRACT( `cb_teammoder`, '$[*].cb_teammode' ),'%Y-%m-%d')) = WEEK(CURRENT_TIMESTAMP)
Last edit: 3 years 11 months ago by rbuelund.

Please Log in or Create an account to join the conversation.

  • rbuelund
  • rbuelund
  • OFFLINE
  • Posts: 565
  • Thanks: 40
  • Karma: 4
3 years 11 months ago #321323 by rbuelund
Replied by rbuelund on topic Field Groups and dates
Hmm.. this filter works:

JSON_EXTRACT( `cb_teammoder`, '$[0].cb_teammode') = '2020-11-09'

but this does not:

YEAR(UNIX_TIMESTAMP(STR_TO_DATE(JSON_EXTRACT( `cb_teammoder`, '$[0].cb_teammode'),'%Y-%m-%d'))) = YEAR(CURRENT_TIMESTAMP)

I do not get why ??

Please Log in or Create an account to join the conversation.

  • rbuelund
  • rbuelund
  • OFFLINE
  • Posts: 565
  • Thanks: 40
  • Karma: 4
3 years 11 months ago #321325 by rbuelund
Replied by rbuelund on topic Field Groups and dates
Ahhh got it now - this works:

WEEK(JSON_UNQUOTE(JSON_EXTRACT( `cb_teammoder`, '$[0].cb_teammode')),0) = WEEK(CURRENT_TIMESTAMP)

Please Log in or Create an account to join the conversation.

  • rbuelund
  • rbuelund
  • OFFLINE
  • Posts: 565
  • Thanks: 40
  • Karma: 4
3 years 11 months ago - 3 years 11 months ago #321326 by rbuelund
Replied by rbuelund on topic Field Groups and dates
Now another question - in the template of the Field Groups - is it possible to get hold of the raw json data somehow in the template, so that I can create my own layout and maybe sort the dates from the JSON data ?
Last edit: 3 years 11 months ago by rbuelund.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48435
  • Thanks: 8275
  • Karma: 1443
3 years 11 months ago #321339 by krileon
Replied by krileon on topic Field Groups and dates

Now another question - in the template of the Field Groups - is it possible to get hold of the raw json data somehow in the template, so that I can create my own layout and maybe sort the dates from the JSON data ?

The JSON data needs to be processed and ran through field parsing behaviors. You shouldn't need to touch the raw JSON data at all. The template files are properly given an array of fields that you can then do whatever you like with. "display_row.php" is the field group row. "display_field.php" is the field group field in a row. "display.php" is the container for rows.

You can access the raw JSON just by accessing the field value from the $user object, but it's pointless as it's all just raw unprocessed data. I've already included a "list" and "table" template to show how you can sort and display the data in different ways. Sounds like the "table" template is more what you're wanting. Review the phpdoc at the top of the template files as you've access to a lot of the processed data there to do whatever you like with.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum