Populate a list from another menu

9 posts by 4 authors in: Forums > CMS Builder
Last Post: March 29, 2010   (RSS)

By willbegood - July 21, 2008

Hello, it's getting me mad!
I have a menu lets sait "Data Sheet", it's a menu to display uploaded pdf.
Each data sheet have
- title
-description
- file (upload)

I have another menu "article" composed as below
- title
- description
- image (uploaded)
- pdf files (this is where i want a list populating from "Data sheet" menu wich will show me the list of the uploaded pdf files

I want the viewer to be able to show me the article and at the end"pdf" link.

Near to be solved... just need to filter some empty data

By willbegood - July 21, 2008

Ok, i'm near to solve my problem, but.. (heyhey i'm the "but" man!!!).
Here is what i've done to make it work.
In my menu "Data Sheet" > on my field "file"(upload) i've defined an extra field (info1) wich i called "name".

The in my menu "Article" i add another field pdf_file (list).
I populate list as below
List option > Get option from database (advanced)
Section tablename > Uploads
Use this field for option values > urlPath
Use this field for option labels > info1

My problem is, as i ask for all the "info1" entry from the files in the uploads directory, i have some blank lines in my Combo (list), because i do not use extra fields info1, info2, info3 etc when uploading image in other menu for exemple.

So what i need is a little filter (perhaps an SQL Query) to help wich will only put info1 data that are NOT empty.

I hope my question is clear.
Sorry for my english, i'm french, i try my best
[:P]

Re: [willbegood] Near to be solved... just need to filter some empty data

By Dave - July 22, 2008

Hi willbegood,

Try having a field datasheetNum (list field) load from the data sheet section:

Section tablename > Data Sheets
Use this field for option values > num
Use this field for option labels > title

And then use a second viewer at the bottom of the page to load the datasheet with:

'where' => "num = '{$articleRecord['datasheetNum']}'",

Let me know if that works for you.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Near to be solved... just need to filter some empty data

By Joseph - March 26, 2010

Hi Dave
I just wanted to check i have followed the instructions in your post so select the right table that i want. However, i am trying to acess data from a table called Venues, i have my data set up in several fields by using - [font "Verdana"]Use this field for option values > num - does this mean it will pull into the record all the info held under the venues table for a particular venue? [/#000000]

i hope this makes sense

Joseph

Re: [socanews] Near to be solved... just need to filter some empty data

By Dave - March 26, 2010

Hi Joseph,

No, it will just store the venue record number, but generally that's what you want. You can look up the venue record by it's record number later if needed.

The reason you want to store record numbers and not venue names or something else is because if you store names and then a name gets changed the link will be broken.

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com

Re: [socanews] Near to be solved... just need to filter some empty data

By Dave - March 26, 2010

Hi Joseph,

Do you just need the venue name or do you need more details from the venue record on that page?
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Near to be solved... just need to filter some empty data

By Joseph - March 26, 2010

I would need to show all the data underneath venue

name
all the addres fields
tube, Bus, website etc.

i thought doing it tis way would be easier so that if i had to change details for the venue it would populate all the records that it was listed on. also instead of users having to enter the venue details all the time they would only need to select the venue name which would return all the details associated with that venue.

Joseph

Re: [socanews] Near to be solved... just need to filter some empty data

By Jason - March 29, 2010

Hi,

You can do what is called a Left Join to join data from the event table and the venue table. Your query will look something like this:
list($eventRecords, $eventMetaData) = getRecords(array(
'tableName' => 'venue',
'loadCreatedBy' => false,
'leftJoin' => array(
'venue' => 'venue_num',
),
));


Where *venue* is the name of your venue table and *venue_num* is the name of the list field in events where you selected a venue. (This is the field that matches num in the venue table).

Let me know if you need any more help with this.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/