Home | Products | Consulting | Hosting | Forums | Support | Order | 1-800-752-0455
  Main
Index
Search
Posts
Who's
Online
Log
In

Home: Products: CMS Builder:
Multiples field from on table populate one field from an othe table

 

 


philb
Novice

Jun 25, 2008, 6:53 PM

Post #1 of 4 (162 views)
Shortcut
Multiples field from on table populate one field from an othe table Can't Post

Hi,

I need to find a way to take 3 fields from one table entered in one Editor and have then populate one field in an other Editor. Lest say in the first section I have 3 field: code, product and format.

I enter all my products using that Editor. I have setup another Editor to enter some special about some chosen products. When adding new special I would like to be able to select products -entered in the previous Editor- from a list that is populated from the code, product, format field from the other table (Editor).

I tried to use the List Options and selected the "Get options from database / MySQL" but it only allows for one field to be selected. Is there a way to merge the data from code,product,format and populate the list field?

Could you give me some hint as to how I can accomplish that?

Thanks for your help

PhilippeSmile
Attachments: multiFieldInToOne.png (71.0 KB)


Dave
Staff / Moderator


Jun 25, 2008, 8:14 PM

Post #2 of 4 (155 views)
Shortcut
Re: [philb] Multiples field from on table populate one field from an othe table [In reply to] Can't Post

Hi Philippe,

You're close. Under list options selected "Get options from MySQL Query (advanced)" and enter this (use your own table prefix and table name instead of cms_tablename):

SELECT num, CONCAT_WS(" ", code, produit, format) FROM cms_tablename

The CONCAT_WS mysql function means "concatenate with string" or "join these fields together with this first value". So in the above example it would join code, produit, and format together with a space and return that as the pulldown "label". I set the pulldown "value" as the num field. If you want the joined value for both just use this:

SELECT CONCAT_WS(" ", code, produit, format), CONCAT_WS(" ", code, produit, format) FROM cms_tablename

Hope that helps! Let me know how it goes.

Dave Edis - Senior Developer
interactivetools.com


philb
Novice

Jun 26, 2008, 8:54 AM

Post #3 of 4 (144 views)
Shortcut
Re: [Dave] Multiples field from on table populate one field from an othe table [In reply to] Can't Post

Hi Dave,

You're a genius. It worked exactly as I wanted. I knew there was something about concatenation of the different values. I just did not know how.

Thanks for this incredible help... again!Wink

Philippe, a very happy guy!Smile


Dave
Staff / Moderator


Jun 26, 2008, 11:02 AM

Post #4 of 4 (136 views)
Shortcut
Re: [philb] Multiples field from on table populate one field from an othe table [In reply to] Can't Post

Glad to help!

I had wondered when I was adding that feature if anyone would ever have a need for it! :) hehe

Dave Edis - Senior Developer
interactivetools.com

 
 
 


Search for (options)
Products
CMS Builder
Article Manager
Realty Manager
Listings Manager
Order Now
Services
Priority Consulting
Hosting
Support
Online Documentation
Support Forums
Support Homepage
Company Info
12 reasons to choose us!
Meet the team
Monthly newsletter
Contact Us
Toll Free: 1-800-752-0455
Phone: (604) 689-3347
Sales | Support
Conditions of Use | Privacy Policy | Copyright © interactivetools.com 2008
#201 - 2730 Commercial Drive, Vancouver BC Canada V5N 5P4