How can I use a CONCAT MySQL function in a valuelist ?
Archived from the Xataface Users forum.
Jean — Thu Dec 10, 2009 5:59 am
Hi Steve,
When I use a CONCAT or a CONCAT_WS function in my valuelist :
- Code: Select all
[sous_type_liste] __sql__ = "SELECT sous_type_contacts.sous_type_contact_id, CONCAT_WS( "__", sous_type_contacts.sous_type_contact_name, type_contacts.type_contact_name ) AS sous_type_contact_name, type_contacts.type_contact_id FROM sous_type_contacts NATURAL LEFT JOIN type_contacts ORDER BY sous_type_contacts.sous_type_contact_name"
I have this error
Error parsing /var/www/listepc/tables/envois/valuelists.ini on line 2 in /var/www/listepc/xataface-1.1.2/Dataface/ConfigTool.php on line 331
Notice: Valuelist query ‘SELECT sous_type_contacts.sous_type_contact_id, CONCAT_WS( ‘ failed. On line 1138 of file /var/www/listepc/xataface-1.1.2/Dataface/Table.php in function printstacktrace()
Is there a solution ? It is made to have a dynamic second select box.
Jean
Jean — Fri Dec 11, 2009 7:19 am
Hello,
Eventually, I found something else to avoid it.
Thank you
Jean
Jean — Fri Dec 11, 2009 7:46 am
I added a page about ths dynamic select boxes from the posts of Steve in the forum. If someone wants to add something :
Jean
shannah — Fri Dec 11, 2009 10:15 am
In response to the CONCAT_WS problem. It is likely the case that some functions (e.g. CONCAT_WS aren’t registered with the parser as available mysql functions). You can add missing functions in the lib/SQL/Parser/Dialect_MySQL.php file, in the ‘functions’ array.
(Although I believe that concat_ws should already be there).
shannah — Fri Dec 11, 2009 10:17 am
Oh… here’s our problem.
- Code: Select all
sql__ = "SELECT sous_type_contacts.sous_type_contact_id, CONCAT_WS( "__", ....
You’re using double quotes inside double quotes. Use single quotes inside your CONCAT_WS function and it should work:
e.g.
CONCAT_WS(‘__’, …
instead of
CONCAT_WS(“__”, …
Jean — Fri Dec 11, 2009 10:44 am