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

 custom listbox

Print topic Send  topic

Author Message
ruhtra


Posts: 30
Posted: 04/27/2010, 1:25 AM

is there any easy way to have a listbox show more than one table column (if possible at all) ?
Arthur
View profile  Send private message
andy


Posts: 183
Posted: 04/27/2010, 2:27 AM

Not sure you can have a listbox appear as a multi-column grid out of the box without using a third-party library, but what you can do is to concatenate fields from one or more tables and display them in the drop down box.
In the Data properties of your listbox set:
Data Source Type: SQL
Data Source: [Enter your custom SQL query here (see example below)]
Bound Column: the value to be stored in your database
Text Column: the value to be displayed in the listbox

Here's an example of a custom SQL query that in this case concatenates 2 fields from the same table (name and vatrate) and displays them with the vat rate in brackets after the name with % at the end e.g. EC (15%).
I then set my bound column to "vatcode_id" and my Text column to the alias "2cols".

SELECT  
vatcode.vatcode_id,  
concat(vatcode.Name," (",vatcode.VATRate," %)") AS 2cols  
FROM vatcode  
ORDER BY  
vatcode.Name ASC 

Obviously you have to do your SQL query to suit but you can separate values with various brackets or | or :: to show that they are different fields. I'm not sure you can align them in columns though.

You can also join tables or use views to extract data from different tables to join fields from different tables.

Hope that helps.
_________________
Andy

RAD tools for rich UI controls:
http://www.koolphptools.com
View profile  Send private message
Waspman

Posts: 948
Posted: 04/27/2010, 3:18 AM

If you're unsure of the code or would like to include more that one table, use the VQB and do it with tables selecting the appropriate fields and setting the relevant where parameters. Then when your happy it works convert it to SQL and concat the fields you want as Andy said.
_________________
http://www.waspmedia.co.uk
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.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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