Page 1 of 1

Populating form display with more than one column

Posted: Thu Dec 05, 2019 12:28 am
by bobbyrabbit
First post, wonderful product..thanks.

I have a table fs_students and am pulling data from column nok_firstname from table fs_nok

You can see this in the page properties display section and is functioning correctly using fs_nok.nok_firstname
I would also like to add nok_lastname to that display.

I'm guessing it would be something similar to fs_nok.nok_firstname & " " & fs_nok.nok_lastname
I'm quite new to this, hope it makes sense
Is this possible?

With thanks
Screenshot 2019-12-04 at 23.13.46.png

Re: Populating form display with more than one column

Posted: Thu Dec 05, 2019 2:30 am
by admin
bobbyrabbit,

Try this (MySQL function)

CONCAT(fs_nok.nok_firstname, " ",fs_nok.nok_lastname);

Re: Populating form display with more than one column

Posted: Thu Dec 05, 2019 2:05 pm
by bobbyrabbit
Thanks for the quick reply. Where would I enter the CONCAT line, my current code in the SQL Builder is:

Code: Select all

SELECT
    fs_students.*,
    fs_nok.*

FROM
    fs_students
        JOIN fs_nok ON fs_nok.fs_nok_id = fs_students.nok

Re: Populating form display with more than one column

Posted: Thu Dec 05, 2019 2:59 pm
by kev1n
It can be added in the display field

Re: Populating form display with more than one column

Posted: Thu Dec 05, 2019 3:15 pm
by bobbyrabbit
Thanks, I put it in the display field initially, it was the semi-colon at the end of the code causing a problem. Now displays perfectly.
I get the information from a dropdown box in the edit section, how do I add the CONCAT code so it also shows first and last name in the dropdown box? Is that in the Form Object List section?

Re: Populating form display with more than one column

Posted: Thu Dec 05, 2019 4:27 pm
by kev1n
Yes, under Form Object List, then select the object and enter an SQL.

Re: Populating form display with more than one column

Posted: Thu Dec 05, 2019 5:06 pm
by bobbyrabbit
Thanks so much guys.
For reference, dropdown box fixed like so:

SELECT
fs_nok.fs_nok_id, CONCAT(fs_nok.nok_firstname, " ",fs_nok.nok_lastname)

FROM
fs_nok