cross information

18 posts by 5 authors in: Forums > CMS Builder
Last Post: June 1, 2009   (RSS)

By benedict - April 29, 2009

Hi Dave,

I'm doing the same thing, but in my case I have an industries table (e.g. Finance, Construction, etc) that has a list field that pulls in a list of lawyers names (from the our_people table) so the user can select which lawyer serves that industry.

I get a feeling that there has been a lot of changes since this last post above, so the info here may be out of date. Is that correct?

As per Oams issue above, if I just paste the code:

<?php echo join(', ', getListLabels('industries', 'industry_specialists', $industriesRecord['industry_specialists'])); ?>

Then I just get the lawyers names, not their photos, links, etc.

If I include your code you have used above:

<?php foreach ($industriesRecords as $industriesrecord): ?>
<?php
list($our_peopleRecords) = getRecords(array(
'tableName' => 'our_people',
'where' => "num = '{$industriesRecord['our_peopleNum']}'",
'limit' => '1',
));
$our_peopleRecord = @$our_peopleRecords[0]; // get first record
?>
People Name: <?php echo $our_peopleRecord['name'] ?>


Then I get this error:

Notice: Undefined index: our_peopleNum in /mypathtotheserver/industries.php on line 138


Any ideas what I am doing wrong?

Re: [benedict] cross information

By benedict - April 29, 2009

BTW - I am using num as the list field value and name as the label.

Re: [benedict] cross information

By ross - April 30, 2009

Hi there.

This is starting to sound like something I'll need to take a closer look at.

Could you send me an email to consulting@interactivetools.com with FTP details and a link to this thread?

The cross connecting of sections is always a little different depending on how you are pulling the data and from which table it's coming from.

Thanks! I look forward to hearing from you :).
-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

Re: [ross] cross information

By benedict - May 12, 2009

Hi guys,

This is really urgent now. I have refined what I'm after, which is much simpler than above. I now just need some advice on a where clause:

I have a Services table that has 10 services listed in it. There are about 3 other sections that will be pulling this information in - our people, news and events (i.e. matching people, news and events will be presented on a service page).

Let's use our people as the example. In the Our People section, I have added a Service list field - I have made this list "Get Options From Database", selected the Services table and used the title field as the labels and the values.

In my our_services.php detail page, I have this:

<?php
require_once "/home/jglimpse/public_html/mst/cmsAdmin/lib/viewer_functions.php";

//detail of this service
list($servicesRecords, $servicesMetaData) = getRecords(array(
'tableName' => 'services',
'where' => whereRecordNumberInUrl(1),
'loadUploads' => '0',
'limit' => '1',
));
$servicesRecord = @$servicesRecords[0]; // get first record

//associated people to this service
list($our_peopleRecords, $our_peopleMetaData) = getRecords(array(
'tableName' => 'our_people',
'allowSearch' => '0',
'where' => ' services LIKE "%something goes here%" ',

));

?>


How do I get the where clause to pull the name of the service page we're now on?

Thanks for your help in advance.[:)]

Re: [benedict] cross information

By ross - May 13, 2009

Hi there.

Thanks for hanging on. I think what you are going to be looking for there is something like this:

'where' => "services LIKE '%\t". $servicesRecords['name'] ."\t%'" ,

See how I just added the servicesRecord variable in there. You will likely need to change the field name but that's the basic idea.

I changed the single quotes on the right side of the = to singles as the singles are needed to go around your potential service name.

I also added in a /t which means it's looking for a tab between each value in the field. When you store a multi select field in your database, it's stored as a tab delimited list.

Give this a shot and let me know how you make out :).
-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

Re: [ross] cross information

By willbegood - May 31, 2009

Hi Ross, I have exactly the same problem, my data are organized in a different way.

Benedict in her exemple Start from "Our People" to ad Services.
For me, i want to start from "Services" and have a field that list "Our People".
And when i have my detail page of my "Service" i want to be able to "see" all the datas for each "Our People" associated to yhis service.

Is it clear for you? Sorry it's always me who trying to build a gmap app, display a location and all its associated restaurant stored in another table.

Re: [willbegood] cross information

By Dave - June 1, 2009

Hi willbegood,

If you don't have many records, sometimes the easiest way to do this is just load the related "people" when displaying each "service". You can do this with the following steps:

- After each service, get it outputting a list of record numbers (one for each "person")
- Create a new getRecords() code block to load all the person records
- all these options:
'allowSearch' => false,
'where' => "num IN (0,$personNumsAsCSV)",
- where $personNumsAsCSV is a comma separated list of person nums (eg: 1,2,3,4)

Give that a try and let me know how it goes.
Dave Edis - Senior Developer
interactivetools.com