Page 1 of 1

Query Builder replacement for SQL STRING() function

PostPosted: Thu Jan 04, 2018 12:20 pm
by huber
Hi All

I wish everyone a happy new year and a good and successful 2018!

I am looking to translate the following SQL statement and can't find the STRING() function replacement in the Servoy Query Builder:

Code: Select all
var query = "\
      SELECT\
         id,\
         STRING('i18n:', name)\
      FROM\
         menus\
      WHERE\
         menu_id IS NULL";

Best regards,

Re: Query Builder replacement for SQL STRING() function

PostPosted: Thu Jan 04, 2018 1:03 pm
by patrick
Without knowing the STRING() function (what database is this??), it looks like you are looking for the concat function...

Re: Query Builder replacement for SQL STRING() function

PostPosted: Thu Jan 04, 2018 3:03 pm
by huber
patrick wrote:Without knowing the STRING() function (what database is this??), it looks like you are looking for the concat function...


The database is SAP SQL Anywhere 17 (once used by Servoy as default database .-) I tried with concat, but I did not find out how to concat a fixed text like 'i18n', followed by a database column name (in my case called name). Any idea?

Regards, Robert

Re: Query Builder replacement for SQL STRING() function

PostPosted: Thu Jan 04, 2018 7:42 pm
by patrick
How about:

Code: Select all
q.result.add(q.functions.concat('i18n:', q.columns.name));

Re: Query Builder replacement for SQL STRING() function

PostPosted: Thu Jan 04, 2018 10:35 pm
by huber
Patrick, exactly what I was looking for! Thanks.

patrick wrote:How about:

Code: Select all
q.result.add(q.functions.concat('i18n:', q.columns.name));

Best regards,