Query Builder replacement for SQL STRING() function

Questions and answers on designing your Servoy solutions, database modelling and other 'how do I do this' that don't fit in any of the other categories

Query Builder replacement for SQL STRING() function

Postby huber » Thu Jan 04, 2018 12:20 pm

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,
Robert Huber
7r AG, Switzerland
SAN Developer
http://www.seven-r.ch
User avatar
huber
 
Posts: 316
Joined: Mon May 14, 2012 11:31 pm

Re: Query Builder replacement for SQL STRING() function

Postby patrick » Thu Jan 04, 2018 1:03 pm

Without knowing the STRING() function (what database is this??), it looks like you are looking for the concat function...
Patrick Ruhsert
Servoy DACH
patrick
 
Posts: 3655
Joined: Wed Jun 11, 2003 10:33 am
Location: Munich, Germany

Re: Query Builder replacement for SQL STRING() function

Postby huber » Thu Jan 04, 2018 3:03 pm

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
Robert Huber
7r AG, Switzerland
SAN Developer
http://www.seven-r.ch
User avatar
huber
 
Posts: 316
Joined: Mon May 14, 2012 11:31 pm

Re: Query Builder replacement for SQL STRING() function

Postby patrick » Thu Jan 04, 2018 7:42 pm

How about:

Code: Select all
q.result.add(q.functions.concat('i18n:', q.columns.name));
Patrick Ruhsert
Servoy DACH
patrick
 
Posts: 3655
Joined: Wed Jun 11, 2003 10:33 am
Location: Munich, Germany

Re: Query Builder replacement for SQL STRING() function

Postby huber » Thu Jan 04, 2018 10:35 pm

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,
Robert Huber
7r AG, Switzerland
SAN Developer
http://www.seven-r.ch
User avatar
huber
 
Posts: 316
Joined: Mon May 14, 2012 11:31 pm


Return to Programming with Servoy

Who is online

Users browsing this forum: No registered users and 2 guests