Existing fields | change order & amount of values

12 years 9 months ago #171161 by pepperstreet
Maybe a dumb question between all those advanced and complex topics ;-)

Is it possible to edit existing fields without errors?

1.) What happens to the (user)data for a multi-checkbox field, if I would...:

- Add a new value
- Delete a value
- ReOrder the values


2.) What is best practice, if I want to replace ALL values of an existing select-field?
For instance I would have to change and update:

ValueOld1, ValueOld2, ValueOld3
to
1stValueNew, 2ndValueNew, 3rdValueNew


Thanks in advance.

Please Log in to join the conversation.

12 years 9 months ago #171188 by krileon

1.) What happens to the (user)data for a multi-checkbox field, if I would...:

- Add a new value
- Delete a value
- ReOrder the values

- Nothing, use can select the new value
- Users with the value selected will reset to blank
- Nothing, just changes display order

2.) What is best practice, if I want to replace ALL values of an existing select-field?
For instance I would have to change and update:

Direct database query to #__comprofiler is probably the best approach.


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.
The following user(s) said Thank You: pepperstreet

Please Log in to join the conversation.

12 years 9 months ago - 12 years 9 months ago #171219 by pepperstreet

krileon wrote:

2.) What is best practice, if I want to replace ALL values of an existing select-field?
For instance I would have to change and update:

Direct database query to #__comprofiler is probably the best approach.


I am asking, because I remember an older project, where I had a similar task. I don´t want to get in trouble again ;-) I don´t know exactly the error-messages, but there were a serious problem on edit-profile... i try to explain what I have done:

- a select-field with
OLDvalue1, OLDvalue2, OLDvalue3

- changed them to
NEWvalue1, NEWvalue2, NEWvalue3

- changed all comprofiler User tables and their respective field values to
NEWvalue1 etc. ...

Is this all I have to check? Are there other references to the older values?
I remember there was an error, as soon as I tried to edit a user profile with this select field.

The naff way to get rid of an error, was to ADD the OLD values again... with an additional separator/hint:

NEWvalue1
NEWvalue2
NEWvalue3
--outdated--
OLDvalue1
OLDvalue2
OLDvalue3

After all values were in the select, everything went smooth...
What is the cause of this behaviour?

Thanks in advance.

Please Log in to join the conversation.

12 years 9 months ago #171351 by krileon
Just query to update a specific field and its value. Example as follows.
UPDATE `jos_comprofiler` SET `myfield` = 'NEWvalue1' WHERE `myfield` = 'OLDvalue1';
UPDATE `jos_comprofiler` SET `myfield` = 'NEWvalue2' WHERE `myfield` = 'OLDvalue2';
UPDATE `jos_comprofiler` SET `myfield` = 'NEWvalue3' WHERE `myfield` = 'OLDvalue3';

You need to ensure the new values actually exist within the field for this to actually work after the query has been made. The new values added via query must also match the values you specified in the field EXACTLY, this is case sensitive.


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

Facebook Twitter LinkedIn