CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 concatenate in Grid Form

Print topic Send  topic

Author Message
gameon

Posts: 10
Posted: 06/07/2004, 7:57 PM

After reviewing the posts on this forum, I am still having problems concatenating two mysql columns in a Grid Form. I have tried using the following BeforeExecutionSelct Custom Code:

function List_ds_BeforeExecuteSelect()
{
$List_ds_BeforeExecuteSelect = true;

global $List;
List->ds->SQL = "SELECT concat(last,' ',first) as name FROM tablename";

However, the php code does not work at run time. ANy suggestions?

Thanks!
View profile  Send private message
ghtracey

Posts: 23
Posted: 06/07/2004, 10:22 PM

Try temporarily editing the .php for the page (not the events) and look for the method (prepare I believe, not having it in front of me) that runs the query (HINT: It will call BeforeExecuteSelect and AfterExecuteSelect in the method) and insert echo $this->ds->SQL:

At the top of the page you should get the select as it is run and you can verify that your select is being run correctly.

I believe that if your form is based on SQL that you write (SQL Source as opposed to Database Column sources created with the query builder) things may not run in the same order. For insance I found that modifying the ds->Where had no effect in that case. Looking at the page PHP source will verify the order that things happen and how your query is built.

_________________
Graham Tracey
Council of Yukon First Nations
View profile  Send private message
RonB

Posts: 228
Posted: 06/12/2004, 7:34 AM

I'm not sure what you are trying to do but here are two ways of concatenating columns:

1. do it in the query to the database for example (mysql)
select concat _ws(',',field1, field2) as cancat1 from table

2. a very easy way is to take the separate labels and put them next to eachother in one cell. :-)

View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.