JOIN question... I think

28 posts by 6 authors in: Forums > CMS Builder
Last Post: July 19, 2011   (RSS)

By Jason - March 8, 2011

Hi,

You many not need to do a join at all. What type of field is team_home and team_away? Are they list fields?

If so, and if you're using CMS Builder version 2.04 or higher, you can use the :label pseudo field to output the list fields label instead of it's value (ie, the name rather than the number).

It would look like this:

<?php echo $record['team_home:label']; ?>

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

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

Re: [Jason] JOIN question... I think

By mbareara - March 12, 2011

Thank you for your reply :D

but it doesn.'t work

I receive this error Notice: Undefined index: articoli_correlati_1:label in /home/....... on line 206

This is my code
<?php if ($record['articoli_correlati_1']): ?>
<ul>
<li><?php echo $record['articoli_correlati_1:label']; ?></a>
</li>
</ul>
<?php endif ?>

By Jason - March 14, 2011

Hi,

What type of field is articoli_correlati_1? What version of CMS Builder are you using?

Let me know.
Thanks
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

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

Re: [zip222] JOIN question... I think

By zip222 - July 19, 2011

So I think I now know why this is happening... my list is multi-value checkbox. If I use a single-value pulldown it works fine. Any way around this?

Re: [zip222] JOIN question... I think

By Jason - July 19, 2011

Hi,

If you're using a fairly recent version of CMS Builder and are using a multi-value list (either drop down or check box) you can use the :labels and :values pseudo fields. These fields are arrays of all of the labels or values selected from that field.

A good way to see everything that is available to you in a record is to use the showme() function. This outputs all the data in the variable passed to it. So if you wanted to see everything stored in the variable $record, you would use:

<?php showme($record);?>

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

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

Re: [Jason] JOIN question... I think

By zip222 - July 19, 2011

If I use :labels it just gives me the word "Array".... ?

Re: [zip222] JOIN question... I think

By Jason - July 19, 2011

Hi,

:labels isn't a single value, but an array of values. For example, if you wanted to output all the labels as a comma separated list, you could do this:

<?php echo join(",", $record['field:labels']); ?>

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

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