Auto Actions: Allocating sequential Entry Numbers and Member numbers

6 years 11 months ago #293528 by RobGG
Hi,
We are loading a long running membership system into CB/CBSubs. There are basically two classes of registration (RegisteredVisitors and Members). On initial entry both a RegisteredVisitor and a Member are allocated a sequential Entry Number. A new Member is allocated a sequential Membership Number. The allocated Entry and (fewer) Membership Numbers stay with the user for their lifetime. (Often a RegistedVisitor will become a Member and will then be allocated a Member Number.) We will load our historic records using cbjuice2, CB fields for the existing Entry Numbers and Membership Numbers have been created and will be populated.

For new registrations we think the best method of accessing the next sequential number (for each of Entry and Membership numbers) would be to use Auto Actions and query the MySQL DB for the current highest number allocated Number (Entry or Membership as appropriate) and add one. Is there a better way? Is this feasible?

Can you assist with some code guidance please?

Regards,

Robert

Please Log in to join the conversation.

6 years 11 months ago #293546 by krileon

For new registrations we think the best method of accessing the next sequential number (for each of Entry and Membership numbers) would be to use Auto Actions and query the MySQL DB for the current highest number allocated Number (Entry or Membership as appropriate) and add one. Is there a better way? Is this feasible?

That's doable using a Query action on the after registration trigger.

Can you assist with some code guidance please?

We do not provide custom coding assistance here. We only provide simple examples at best of which there are many around the forums. Your query would likely be an update query on _comprofiler setting the value of the field to a subquery. Example as follows.

UPDATE `#__comprofiler` SET `FIELD_NAME` = ( SUBQUERY_FOR_NEXT_VALUE_HERE ) WHERE `id` = '[user_id]'


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.204 seconds

Facebook Twitter LinkedIn