CodeCharge Studio
search Register Login  

Visual PHP Web Development

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

YesSoftware Forums -> Archive -> GotoCode Archive

 How do I get listbox to display concatenate fields

Print topic Send  topic

Author Message
chaskunz
Posted: 06/17/2002, 11:42 AM

I want a listbox to display {firstname}[space]{lastname} on each line. What's the best way to accomplish this? Thanks...
banjo
Posted: 06/17/2002, 2:49 PM

In SQL for listbox

SELECT tableID, Firstname+" "+Lastname FROM TABLENAME ORDER BY Lastname
Labs4.com
Posted: 06/24/2002, 6:35 PM

here is MySQL example how to solve this prob, use CONCAT_WS

Description:
CONCAT_WS(separator, str1, str2,...)
CONCAT_WS() stands for CONCAT With Separator and is a special form of CONCAT(). The first argument is the separator for the rest of the arguments. The separator can be a string as well as the rest of the arguments. If the separator is NULL, the result will be NULL. The function will skip any NULLs and empty strings, after the separator argument. The separator will be added between the strings to be concatenated:

SELECT ID, CONCAT_WS(" ",firstname,lastname) as firstname
FROM my_table ORDER by lastname

in grid you will address label firstname which must have Data type Text or Memo

-> more about MySQL string functions is available at http://www.mysql.com/doc/S/t/String_functions.html

Josef
Labs4.com
Posted: 06/24/2002, 6:43 PM

small correction of my previous post - it doesn't work with double quotes, you have to use single quotes in SQL query:

SELECT ID, CONCAT_WS(' ',firstname,lastname) as firstname
FROM my_table ORDER by lastname

Josef
chaskunz
Posted: 06/26/2002, 7:25 AM

The problem is that in CCS, listbox values are generated by function Show() in classes.php, and all that shows in html is {employee_Options}. How do I get the Value that is processed by Show() to be these concatenated fields in CCS? The listbox properties only allows for one dropdown field to be chosen.
Labs4.com
Posted: 06/26/2002, 11:45 AM

read my first (long) post again, only thing I can add are settings of listbox
Bound Column: employee_ID
Text Column: firstname (result of CONCAT_WS function merging firstname and lastname with separator ' ')

I tried that and it really works.
chaskunz
Posted: 06/26/2002, 12:25 PM

and thanks!!

   


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

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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