Joomla 5 Notice

We are pleased to announce that as of October 14, 2025, all of our Joomla extensions are compatible with Joomla 6.

For all who are still updateing from Joomla 3 to Joomla 4: Joomla 4 Migration instructions are available here:

There is a separate Documentation for Visforms for Joomla 4 and for Visforms for Joomla 5 and 6!

Forum

Visforms Subscription user can ask questions in our forum. Please log in with the relevant user first.
Everybody can access the forum for reading.

Please only ask 1 question per topic.

Important information for almost every question:
V1: Which Visforms version is running?
V2: Which Joomla version is running?
V3: Which PHP version is running?

Requete SQL

More
3 years 6 months ago #8097 by av_74
Requete SQL was created by av_74
Hello Aicha I have a field: first name (F166) and a field: Last name (F167)
I would like to combine these 2 fields in a "Select sql" type field but I can't find the right syntax the query only displays the first name
Here is the SQL-Select-Statement query :
SELECT id as value,  F166 as label, F166 as value,  F167 as label, F167 as value FROM `aspt_visforms_6`  ORDER BY F166

Can you help me ?
cordially
Alain

More
3 years 6 months ago #8098 by Administrator IV
Replied by Administrator IV on topic Requete SQL
Hello Alain,

please try this:
select id as value, concat(F166, ' ', F167) as label from aspt_visforms_6 order by F166;

and listen to:
www.w3schools.com/sql/func_mysql_concat.asp

Remarks:
The back ticks ` are only necessary when using reserved words.
The characters upper case is optional and good for readability in more or less large statements;

Best regards, Ingmar

:idea: I recommend you the new and up-to-date documentation for Joomla 5:
docs.joomla-5.visforms.vi-solutions.de/en/docs/
Most of this also applies retrospectively to Joomla 4.
Please only ask 1 question per topic :-).

:idea: Ich empfehle Dir die neue und aktuelle Dokumentation für Joomla 5:
docs.joomla-5.visforms.vi-solutions.de/docs/
Das meiste gilt rückwirkend auch für Joomla 4.
Bitte immer nur 1 Frage pro Thema stellen :-).

More
3 years 6 months ago #8101 by av_74
Replied by av_74 on topic Requete SQL
Hello Ingmar
Here is a new request :SELECT CONCAT_WS('F166','F167') as 'F283' FROM aspt_visforms_6

When I click on the test button the message success: found 28 entries appears.
But when I go to the list field of my form, it is empty
Avez vous une solution ?

Best regards
Alain

More
3 years 6 months ago - 3 years 6 months ago #8104 by Administrator IV
Replied by Administrator IV on topic Requete SQL
Hello Alain,

The function CONCAT_WS() fits your needs perfectly as to join two or more strings with a separator!
The message 'success: found 28 entries' does tell you that you have a valid select statement which returns a record set having 28 entries.

The test is not looking for this:
But the SQL statement SQL statement must return a value and a label (Visforms Documentation).
This is why the list remains empty.
www.vi-solutions.de/en/documentations/do...m-database-using-sql

Please re-try something like this:
SELECT id as value, CONCAT_WS('F166','F167') as label FROM aspt_visforms_6

This SQL statement gives you a listbox filled with options, which have the recordset id as option values and the 'string-concatenation' (names) as option labels (or visible text).
The option value (the recordset id of the selected name) get saved to the database into the SQL listbox field.

Or re-try something like this:
SELECT CONCAT_WS('F166','F167') as value, CONCAT_WS('F166','F167') as label FROM aspt_visforms_6

This SQL statement gives you a listbox filled with options, which have the  'string-concatenation' (names) as option values and as option labels (or visible text).
The option value (the 'string-concatenation' of the two names) get saved to the database in the SQL listbox field.

As a general note I have to tell you, that some decent experience in writing/understanding SQL select statement is quite helpful.
Nothing else or special (apart from must return a value and a label) goes on here.
Must return a value and a label means, that the statement as to declare the two resulting parts:
'something' as value
'something' as label

Best regards, Ingmar

:idea: I recommend you the new and up-to-date documentation for Joomla 5:
docs.joomla-5.visforms.vi-solutions.de/en/docs/
Most of this also applies retrospectively to Joomla 4.
Please only ask 1 question per topic :-).

:idea: Ich empfehle Dir die neue und aktuelle Dokumentation für Joomla 5:
docs.joomla-5.visforms.vi-solutions.de/docs/
Das meiste gilt rückwirkend auch für Joomla 4.
Bitte immer nur 1 Frage pro Thema stellen :-).
Last edit: 3 years 6 months ago by Administrator IV.

More
3 years 4 months ago #8202 by av_74
Replied by av_74 on topic Requete SQL
select id as value, concat(F166, ' ', F167) as label from aspt_visforms_6 order by F166;

it works perfectly Thank you
Best regards

Moderators: Administrator AVAdministrator IV
Powered by Kunena Forum