How to concatenate two fields in a libreoffice base report

I want to concatenate three name fields in a LibreOffice Base report. In Microsoft Access, I used the following: = [Last Name]&”, “&[First Name]&” “&[Middle Name]. How do I do this in a Base report with the same name fields?

Did you try it? Have tested it the same way - no problem here. But you will get empty results when one of the fields is NULL.

Better: Use your database for getting the fields as you want. Create a view for your report which creates a separate field.
Something like

SELECT 
"Last Name"||","||
COALESCE(' '||"First Name",'')||
COALESCE(' '||"Middle Name",'') AS "Name" 
FROM "Tablename"
1 Like

I like the “Better” option, but I’m a newbie to LibreOffice Base, and have no idea how to “create a view” for a report. Is this a modification to the database? Or the Report? Could you please give me a step-by-step as how to do that? Thanks!!!

Try to create a query for the report in Base. This query should contain all fields you need in the report. Also the fields “Last Name”, “First Name” and “Middle Name”.
Then switch from design view to SQL.
Copy

, "Last Name"||','||
COALESCE(' '||"First Name",'')||
COALESCE(' '||"Middle Name",'') AS "Name"

and insert it directly before “FROM”.

Hope you will get the right result in query with that.

If query works well you could use the query in report.
If report doesn’t work well with this query: Right mouse click on the query and create a view from this query. Views are queries, which will be executed directly in the database. So GUI of Base doesn’t try to understand the code, only takes the view the same way as a table.

Download Base Guide 7.3 for more information.

Here’s what I got

Check the message and replace double quotes around comma "," with single quotes ',' after your "LastName".
.
Or you would need a column named , wich is filled with ',' to satisfy the error message :grinning:

I see, was my mistake. Have corrected it.