Dynamic Valuelists, more than 0ne Column selected

A place for users and developers of the Xataface to discuss and receive support.

Postby sym » Wed Jun 21, 2006 1:41 am

I would like to combine 2 tables:

table1: [EMPLOYEES_BUSINESS]
EMPLOYEE_ID ; EMPLOYEE_FIRSTNAME ; EMPLOYEE_MIDDLENAME ; EMPLOYEE_LASTNAME ; EMPLOYEE_INITIALS


table2: [EMPLOYEES_GROUPS]
EMPLOYEE_ID ; GROUP_ID


In valuelists.ini of [EMPLOYEES_GROUPS] i tried:

[EMPLOYEES_BUSINESS]
__sql__ = "SELECT EMPLOYEE_ID, EMPLOYEE_LASTNAME, EMPLOYEE_MIDDLENAME, EMPLOYEE_FIRSTNAME FROM EMPLOYEES_BUSINESS ORDER BY EMPLOYEE_LASTNAME"

I see that only the first parameter (EMPLOYEE_LASTNAME) in the table displayed.
Is it possible to show more then 1 column (or 1 column with the data of more then 1 columns) ?
sym
 
Posts: 13
Joined: Wed Dec 31, 1969 5:00 pm

Postby njw » Wed Jun 21, 2006 10:36 am

njw
 
Posts: 280
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Wed Jun 21, 2006 3:31 pm

Thanks for digging up that post, Neil. The key here is to do the combination in MySQL rather than in dataface. Valuelists expect the first column to be the id and the 2nd column to be the value displayed. It ignores the third, fourth, etc.. columns. However, MySQL has a nifty CONCAT function the can concatenate multiple columns together into one...
so:

[EMPLOYEES_BUSINESS]
__sql__ = "SELECT EMPLOYEE_ID, CONCAT(EMPLOYEE_LASTNAME, ',',EMPLOYEE_MIDDLENAME,',', EMPLOYEE_FIRSTNAME) as FullName FROM EMPLOYEES_BUSINESS ORDER BY EMPLOYEE_LASTNAME"

This should get the desired results.
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby sym » Fri Jun 23, 2006 2:05 am

Steve,

Thanks for the perfect answer!

I tried to make a web-based program to update my database, last week.
Normaly i programmed in PHP/javascript/mysql a user interface to show/update the tables.

Dataface is a universel toolbox to do this in a minimum of time, and whithout real programming and Dataface is more flexible: changing the database and the application is also updated.

You made a wonderfool tool!
Thanks you so much.

Greetings,
Nico Sijm
sym
 
Posts: 13
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Fri Jun 23, 2006 7:33 am

Hi Nico,

Glad you found it to be helpful. Thanks for the glowing review :)

-Steve
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 37 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved