I have done a lot of research on this and am stumped.

I have created two content types via CCK.
I would like to populate a CCK Text field with a "Select List" widget in the first content type with data from another CCK text field in a second content type. Base on my research, the best way to do this is via SQL. I have the SQL query that generates the data that I need, but I cannot figure out how to "hot wire" it into the respective field.

Based on the PHP code snipets that I have found, I think I need to create and populate an array with the data returned by the SQL query. c.f. http://blue.live4all.co.il/~mooffie/cms/node/17

Can someone point me to a "generic" template for adding a SQL query to a CCK field?

I have been documenting my Drupal experience on my blog, if any one is interested:
http://www.sageofcode.com/

Comments

SageOfCode’s picture

for anyone interested...

I just figured out that the drupal API call db_duery is required:

http://api.drupal.org/?q=api/function/db_query/5

I saw this function call in the code snipet that I found, but did not know it was a drupal api.
I have reached a higher level of ignorance.
I will continue to climb this mount called DRUPAL and keep you posted.

ANY HELP...would be MUCH, MUCH, appreciated.

-SOC

SageOfCode’s picture

This is the best explanation that I found:

http://drupal.org/node/233237

-SOC

asak’s picture

And so i understand you got it working...

Care to share some code? ;)

afagioli’s picture

there's a nice feature for cck text select fields which allows you to populate list with a view result.

see: "Advanced - Nodes that can be referenced (View)" when editing your cck text select field (views enabled, of course)

www.fagioli.biz - software and web services

Parkes Design’s picture

Never thought about doing it this way... thanks I'll give it a shot.

novovox’s picture

This looks like a solution I need. I have built my view easy enough. However, I can't find any option for "Advanced - Nodes that can be referenced (View)" when I am building my content type. Can anyone tell me where this option should appear?

D6.16

novovox’s picture

Solved. I was selecting a "text" field - need to select a "node reference" field. Works sweet.

aryankumar073’s picture

For less technical discussions about the Drupal project. Not for support questions! ... The General discussion forum is not for Drupal support questions. ...