Filter a User List by Date field

5 months 3 weeks ago #335023 by ernienet
Filter a User List by Date field was created by ernienet
I have added a date field in Community Builder. My clients use it to enter an expiration date for membership (not using CBSubs).

What do I enter in the criteria to indicate that the date value must be greater than "TODAY" (the server date - or wherever the current date is retrieved for calculations).

I have [field name] [greater than] and [] (nothing). what can I put there so that when that equation is no longer true, the member will no longer show on the list?

Thank you,
Ernie

Please Log in to join the conversation.

5 months 3 weeks ago #335024 by krileon
Replied by krileon on topic Filter a User List by Date field
You'll need to use an Advanced filter to do that so you can directly modify the userlist query. Basic filters are for very simple usage. Give the following a try.
ue.`FIELD_NAME` > NOW()

Replace FIELD_NAME with whatever your date fields name is. As for table aliases "ue" is for _comprofiler and "u" is for _users


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 to join the conversation.

5 months 3 weeks ago #335027 by ernienet
Replied by ernienet on topic Filter a User List by Date field
I have two Basic filter items as well. It seems that when I create an Advanced filter, the Basic filters are lost.

And I don't understand the ue. part of the formula. I've used the Advanced filtering in the past, but I don't recall there being a conflict with Basic filters. Can they not be used together?

When I entered ue.'cb_sponsor_expire_date' > NOW(), I got an error on the website. When I removed the ue. part of it, I got a different error.

Do I need to create an Advanced filter for all the filters in order to use the Advance filter for one of them?

Thank you,
Ernie

Please Log in to join the conversation.

5 months 3 weeks ago #335028 by krileon
Replied by krileon on topic Filter a User List by Date field
You can't use Basic and Advanced filtering at the same time. You'll need to move your basic filters into advanced. Advanced filters are just SQL that gets added to the userlist query. So everything you can do in SQL in the WHERE statement of a query you can do there.

When I entered ue.'cb_sponsor_expire_date' > NOW(), I got an error on the website. When I removed the ue. part of it, I got a different error.

You're getting an error because you're using single quotes instead of backquotes. See my example above.


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 to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.218 seconds

Facebook Twitter LinkedIn