Skip to Content Skip to Menu

🎃 Happy Halloween! Treat yourself with an awesome discount! Get 20% off now with code SPOOKY-2024!

Increment auto numbering

  • cardoso69
  • cardoso69
  • OFFLINE
  • Posts: 27
  • Thanks: 1
  • Karma: 0
  • Add-ons
11 years 9 months ago #219417 by cardoso69
Increment auto numbering was created by cardoso69
Hello.
I'm very new to CB.
I need to create a field with incremental auto numbering, like an id.
Is there a way to do it with CB?

i.e. - Joomla has its own id for each user, but i need to create a unique id for some selected users...

Please Help.

Best Regards.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48454
  • Thanks: 8280
  • Karma: 1443
11 years 9 months ago #219447 by krileon
Replied by krileon on topic Increment auto numbering
Users already have a unique ID. Add [user_id] to a delimiter field to display it. Alternative is to create an integer field then use CB Auto Actions with a Query action at whatever trigger you want it to be incremented at (registration I suppose?) that queries _comprofiler for that column and increments it (order by that column and limit to 1) then stores it to the user.


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.

  • cardoso69
  • cardoso69
  • OFFLINE
  • Posts: 27
  • Thanks: 1
  • Karma: 0
  • Add-ons
11 years 9 months ago #219633 by cardoso69
Replied by cardoso69 on topic Increment auto numbering
Dear krileon.
Yes, Joomla already sets an auto increment id. Before saying what i do really need, let me say i'm using J!2.5 and CB 1.9.
But what i was looking for is a solution for this, maybe a little bit complicated:

- 2 Groups created. Group 1 and Group 2
- 4 Users created. User 1, User 2, User 3 and User 4.
- Make users 1 and 2 members of Group 1
- Make users 2 and 3 members of Group 2

User 1 should have an ID (not J! id) like 1001 ( Group 1)
User 2 should have an ID (not J! id) like 1002 ( Group 1)

User 3 should have an ID (not J! id) like 2001 ( Group 2)
User 4 should have an ID (not J! id) like 2001 ( Group 2)

Users cannot self register and all the registrations are made on the back-end, but i need to have a auto suggested ID (not J! id) for each user in each group.

Do you think this is possible?

Thanks in advance.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48454
  • Thanks: 8280
  • Karma: 1443
11 years 9 months ago #219651 by krileon
Replied by krileon on topic Increment auto numbering
That's possible, but you're going to have to write the database queries to handle all of that. Probably better to be done in a new CB plugin using triggers to do all the complex calculations needed. There's no easy way to do it.


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.

  • cardoso69
  • cardoso69
  • OFFLINE
  • Posts: 27
  • Thanks: 1
  • Karma: 0
  • Add-ons
11 years 9 months ago #219823 by cardoso69
Replied by cardoso69 on topic Increment auto numbering
Huummm...
Well, so, what if i simplify a bit...

Can i create a field related with a group, where i set an initial value [1001] and then set manually when the user is created.

The only thing is it should suggest the next available number and not allow use already used numbers.

Is this easier?

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48454
  • Thanks: 8280
  • Karma: 1443
11 years 9 months ago #219863 by krileon
Replied by krileon on topic Increment auto numbering
You can create a read only field and manually set it, sure, but it's not going to check that the number is already used (you can try using DB Lookup for that). It still won't suggest the next number though. You need a custom solution for what you're wanting.


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