copy value from field

More
12 years 3 weeks ago #24410 by ldps
copy value from field was created by ldps
hello!
Please help, we have:
1) The field of "original" (text type), where the user is assigned a unique number.

2) The field of "copy" (SELECT type, id=33), where I just want to automatically copy the value from a field of "original".

Ready-made solutions are not found. try through the sql query.

I tried to make such a request, but I have shown an empty field:
SELECT name FROM jos_flexicontent_fields where id=33

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

More
12 years 3 weeks ago #24420 by ggppdk
Replied by ggppdk on topic copy value from field
Lets say the id of the old field is 22 and the id of the new field is 33. Remember you must first create the new field, AND MAKE SURE you have not edited any items yet to add values to it, if you have delete the new field and recopy the old.

The queries to copy the data values of the old field are:
Code:
INSERT INTO jos_flexicontent_fields_item_relations (`field_id`,`item_id`,`valueorder`,`value`) SELECT 33,`item_id`,`valueorder`,`value` FROM `jos_flexicontent_fields_item_relations` WHERE `field_id`=22;

Code:
INSERT `jos_flexicontent_items_versions` (`version`,`field_id`,`item_id`,`valueorder`,`value`) SELECT `version`,33,`item_id`,`valueorder`,`value` FROM `jos_flexicontent_items_versions` WHERE `field_id`=22;

Execute the above in phpmyadmin, and replace "jos_" with what your db uses.

I guess we could add option to the field copy task for coping both field configuration and data?


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

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

More
12 years 3 weeks ago #24432 by ldps
Replied by ldps on topic copy value from field
This code should be inserted in phpmyadmin?

I just do not correctly describe ьн idea, I would like to insert sql query in a field "select", and when i create the article, value of the field number 1 copyed in the field number 2. It's real?

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

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.263 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline