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/

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: [Jason] JOIN question... I think

By zip222 - July 19, 2011

I am having this issue as well. undefined variable when using the :label pseudo field.

It is with a "list" field type
getting options from database (advanced)
- option values: num
- label values: title

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/