Formatting options for QBSelect

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

Formatting options for QBSelect

Postby steve1376656734 » Wed Apr 10, 2024 10:47 am

In developer we can format our code using the Source -> Format menu (or a keycode combination). The way the code is formatted can be controlled using various options in the Developer settings in the Javascript -> Formatter section. I have set these so that when I format my code I get pretty much the layout I want but I cannot seem to control the way that a QBSelect is formatted.

I have the following code before the format:

Code: Select all
qMedias.where
   .add(qMedias.columns.tenant_name.eq(recTenant.tenant_name))
   .add(qMedias.columns.path.eq(path))
   .add(qMedias.columns.name.eq(docName))
   .add(qMedias.or
      .add(qMedias.columns.sha256.eq(sha256))
      .add(qMedias.columns.sha256.isNull));

I would very much like it to stay that way as I feel it makes the code more readable but when I format the code I end up with the whole statement on one line.

Code: Select all
qMedias.where.add(qMedias.columns.tenant_name.eq(recTenant.tenant_name)).add(qMedias.columns.path.eq(path)).add(qMedias.columns.name.eq(docName)).add(qMedias.or.add(qMedias.columns.sha256.eq(sha256)).add(qMedias.columns.sha256.isNull));


Are there any settings I can change that will allow the statement chaining to remain on separate lines?

TIA
Steve
Steve
SAN Developer
There are 10 types of people in the world - those that understand binary and those that don't
steve1376656734
 
Posts: 330
Joined: Fri Aug 16, 2013 2:38 pm
Location: Ashford, UK

Re: Formatting options for QBSelect

Postby Richard1521662995 » Wed Apr 10, 2024 12:03 pm

+1
Richard Clarke
acss.co.uk
Richard1521662995
 
Posts: 40
Joined: Wed Mar 21, 2018 10:09 pm

Re: Formatting options for QBSelect

Postby huber » Fri Apr 12, 2024 8:56 am

+1
Robert Huber
7r AG, Switzerland
SAN Developer
http://www.seven-r.ch
User avatar
huber
 
Posts: 518
Joined: Mon May 14, 2012 11:31 pm

Re: Formatting options for QBSelect

Postby steve1376656734 » Fri Apr 12, 2024 12:08 pm

I have added a feature request for this here
Steve
SAN Developer
There are 10 types of people in the world - those that understand binary and those that don't
steve1376656734
 
Posts: 330
Joined: Fri Aug 16, 2013 2:38 pm
Location: Ashford, UK

Re: Formatting options for QBSelect

Postby gerardimmeker » Fri Apr 12, 2024 3:53 pm

You can add // to the end and start on a new line.
Then the formatter will skip the qbSelect

var qVehicles = datasources.db.autoflex_cloud.vehicles.createSelect();
qVehicles.where.add(//
qVehicles.and.add(//
qVehicles.or.add(//
qVehicles.columns.is_archived.isNull)//
.add(qVehicles.columns.is_archived.eq(0)))//
.add(qVehicles.columns.is_company_stock.eq(1)))//
.add(qVehicles.joins.vehicles_to_purchase_sales.columns.order_line_vehicle_sale_id.eq(null)//
);
gerardimmeker
 
Posts: 16
Joined: Tue Sep 27, 2011 4:11 pm

Re: Formatting options for QBSelect

Postby steve1376656734 » Fri Apr 12, 2024 6:10 pm

Great tip!

Thanks
Steve
SAN Developer
There are 10 types of people in the world - those that understand binary and those that don't
steve1376656734
 
Posts: 330
Joined: Fri Aug 16, 2013 2:38 pm
Location: Ashford, UK


Return to Programming with Servoy

Who is online

Users browsing this forum: Bing [Bot] and 10 guests