Rename and sync field dropdown value

4 years 11 months ago #312218 by mcberstene
Rename and sync field dropdown value was created by mcberstene
I have a field titled Region, which offers values from a dropdown menu such as Region I, Region II and Region III, for example. I want to change all the Roman Numerals to regular numbers, such as 1, 2 and 3. While I am able to easily change the selections in the Field Management, what's the easiest way to change all the members who currently have Roman Numerals?

Please Log in to join the conversation.

4 years 11 months ago #312243 by krileon
Replied by krileon on topic Rename and sync field dropdown value
You can specify a separate value and label. Leave Value as is to avoid having to update the storage of every user (of which you will need to do manually using SQL in phpmyadmin). Simply adjust Label to whatever you like and that's what will be displayed in the dropdown and on profile.


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.

4 years 9 months ago #313034 by mcberstene
Replied by mcberstene on topic Rename and sync field dropdown value
Thank you. I've done that successfully.

The field can be queried as an advanced search drop down menu option: Region I, Region II, Region III, etc. When, for example, Region I is selected for the search it returns all results for Region I, Region II, and Region III. This is because each has the "I" in the label.

How do I overcome this? I suppose I need to write a validation for the CB query? Can you help with this?

Please Log in to join the conversation.

4 years 9 months ago #313046 by krileon
Replied by krileon on topic Rename and sync field dropdown value
The search does not search labels. It searches stored values. For a multi-checkbox or multi-select the selected values are stored as VALUE_1|*|VALUE_2|*|VALUE_3 so if you have the values actually set to "Region I", "Region II", and "Region III" that will be a problem since the database query to search such a field uses LIKE the result is "Region II" and "Region III" both contain "Region I" so you'll get all 3 in your results. Values should always be unique from one another. Always use Label for the display values. So for example you should have had something like the below.

Value: R01
Label: Region I

Value: R02
Label: Region II

Value: R03
Label: Region III

In short just be sure one value does not contain another value.


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.

4 years 9 months ago #313066 by mcberstene
Replied by mcberstene on topic Rename and sync field dropdown value
Thank you for that answer.

In targeting the SQL tables for replacing the old values with the new, which should I select in this case?

Please Log in to join the conversation.

4 years 9 months ago #313074 by krileon
Replied by krileon on topic Rename and sync field dropdown value
See the below topic with user running into same problem. Query provided to fix the values.

www.joomlapolis.com/forum/255-developer-members-support/241142-error-with-filter

Example for your case as follows.

UPDATE `jos_comprofiler` SET `FIELD_NAME` = REPLACE( REPLACE( REPLACE( `FIELD_NAME`, 'Region III', 'R03' ), 'Region II', 'R02' ), 'Region I', 'R01' )

Be sure to replace jos_ table prefix and FIELD_NAME to fit your site and field.


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

Facebook Twitter LinkedIn