[SOLVED] Using conditional values form Date of Birth?

12 years 3 months ago - 12 years 2 months ago #191179 by mike5151
Hello

J 1.7
CB 1.7.1
CBSubs 1.2.2

I am organising a membership website for a community sports club. In the Youth section Communication and much else is organised through age-group squads - ie u6, u7 etc. Membership of an age group is defined by the members' age at 1st September of the current season.

Thus members of the U6 team for the 2012/2013 season will have DOB field values in the range of 01/09/2006 to 31/08/2007. I have added a DOB field to the registration form and installed the Conditional Plugin.

Option 1

I wondered if I could use the DOB value to automatically assign an age group. The advantage of that arrangement would be that only one 'Youth' subscription plan would be required and all members could easily be 'upgraded' at the end of the season.

Option 2

I guess the alternative is to create an indivdual subscription plan for each age group and create individual upgrade paths for each one - U6 to U7 etc.

I can't see how I could easily use the conditional plugin values as the 1st September date is not static but I am a long way from being an expert and I would be interested in your view.

Kind regards

miike

Please Log in to join the conversation.

12 years 3 months ago #191206 by nant

mike5151 wrote: I wondered if I could use the DOB value to automatically assign an age group. The advantage of that arrangement would be that only one 'Youth' subscription plan would be required and all members could easily be 'upgraded' at the end of the season.


Thinking that you could use the CB Auto-actions plugin to trigger after registration and set value of the age group field based on the dob field.
The following user(s) said Thank You: mike5151

Please Log in to join the conversation.

12 years 2 months ago #191669 by mike5151
Thank you for the nudge in the right direction.

I have tried to implement your suggestion but I'm not quite there yet.

I have set the field which I want to receive the auto-trigger instruction as follows.

Type: Text field
Name: cb_juniouragegroup
Title: Junior Age Group
Required: No
Show in profile: Yes
Searchable in users lists: Yes
User Read Only: No
Show at rgistration: No
Published: Yes

The auto-trigger is then set as follows:

Published: yes
Title: Assign Junior U13
Description: Assigns Youth Member to the U13 age group after registration dependant on their DOB
Type: Field
Triggers: onAfterUserRegistration
user: Automatic
Access: Everybody
Conditional 1: cb_dob Greater Than or equal to 01/09/1999
Conditional 2: cb-dob Less Than 01/09/2000
Field: Juniour Age Group
Operator: Set (Field = Value)
Value: U13

Registering a test member with a DOB of 02/09/1999 does not result in a value of 'u13' appearing in the Junior Age Group field.

I'd be grateful for your assistance.

Kind regards

Mike

Please Log in to join the conversation.

12 years 2 months ago #191683 by nant
thinking that date comparison should use YYYY-MM-DD format.

Please Log in to join the conversation.

12 years 2 months ago #191695 by mike5151
Thank you.

Have turned the date format round in cb_dob to yyyy/mm/dd and adjusted the auto action to

Conditional 1: cb_dob Greater Than or equal to 1999/09/01
Conditional 2: cb_dob Less Than 2000/09/01

Regrettably no result.

Any further ideas?

Kind regards

Mike

Please Log in to join the conversation.

12 years 2 months ago #191697 by nant

mike5151 wrote: Thank you.

Have turned the date format round in cb_dob to yyyy/mm/dd and adjusted the auto action to

Conditional 1: cb_dob Greater Than or equal to 1999/09/01
Conditional 2: cb_dob Less Than 2000/09/01

Regrettably no result.

Any further ideas?

Kind regards

Mike


That's not what I said.

There is no reason to change the date format.
No matter what format you select in CB Configuration the value written in the database should look like:

YYYY-MM-DD HH:MM:SS

That is why I told you to use the YYYY-MM-DD value in criteria.


So

Conditional 1: cb_dob Greater Than or equal to 1999/09/01
Conditional 2: cb_dob Less Than 2000/09/01


should become

Conditional 1: cb_dob Greater Than or equal to 1999-09-01
Conditional 2: cb_dob Less Than 2000-09-01

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.205 seconds

Facebook Twitter LinkedIn