[Solved] CASE Boolean Clauses Nested Indentation Doesn't Work

6 Posts
3 Users
2 Reactions
263 Views
(@jpotelle)
Member
Joined: 2 years ago
Posts: 15
Topic starter  

I'm not sure which options controls this... Boolean clauses, with parentheses, are not indented "properly". The sample code in the plugin has only very simple Boolean and doesn't reflect a complex clause.  See example below

Notepad++ v8.4.5 (x64)
SQLinForm GUI 6.22.9.9, Engine 6.22.03.31

Here is example of as close as I could get.

CASE
  WHEN SHORT_DCE_TYPE IN ('S', 'N')
    AND ( ALGN_TYPE               = 'C'
    OR ( ALGN_TYPE                = 'V'
    AND VA_CAT                    = 'C' ) )
    AND FIN_ELIG                  = 1
    AND BENE_RATIO                <= 3.00
    AND ( ( BNMRK                 = 'A'
    AND RYSUM.BENE_DCNT_ANNUAL_RY >= 1500 )
    OR ( BNMRK                    = 'E'
    AND RYSUM.BENE_DCNT_ANNUAL_RY >= 50 ) )
    THEN 0.12345
  WHEN SHORT_DCE_TYPE = 'H'
    OR ( SHORT_DCE_TYPE IN ('S', 'N')
    AND ALGN_TYPE = 'V'
    AND VA_CAT    = 'N' )
    THEN 0.56789
  ELSE NULL
END AS THIS_VALUE

The nested indentation of Boolean causes I'm trying to obtain should be something like this:

CASE
  WHEN SHORT_DCE_TYPE IN ('S', 'N')
    AND ( ALGN_TYPE               = 'C'
          OR ( ALGN_TYPE          = 'V'
               AND VA_CAT         = 'C' ) )
    AND FIN_ELIG                  = 1
    AND BENE_RATIO                <= 3.00
    AND ( ( BNMRK                 = 'A'
            AND RYSUM.BENE_DCNT_ANNUAL_RY >= 1500 )
          OR ( BNMRK              = 'E'
               AND RYSUM.BENE_DCNT_ANNUAL_RY >= 50 ) )
    THEN 0.12345
  WHEN SHORT_DCE_TYPE = 'H'
    OR ( SHORT_DCE_TYPE IN ('S', 'N')
         AND ALGN_TYPE = 'V'
         AND VA_CAT    = 'N' )
    THEN 0.56789
  ELSE NULL
END AS THIS_VALUE

   
Quote
(@guidomarcel)
Member
Joined: 2 years ago
Posts: 9
 

Hi jpotelle,

thanks for your feedback. I think the formatting rules you are looking for is already implemented for the WHERE conditions

Example

grafik

 

I could indeed try to implement these rules also for the CASE statement

 

Regards

Guido

This post was modified 2 years ago by guidomarcel

   
jpotelle reacted
ReplyQuote
(@jpotelle)
Member
Joined: 2 years ago
Posts: 15
Topic starter  

Yes, that would be very helpful ? 


   
ReplyQuote
(@guidomarcel)
Member
Joined: 2 years ago
Posts: 9
 

@jpotelle first tests were successful. Hope to publish it end of this week

 

grafik

Regards

Guido

This post was modified 2 years ago 2 times by guidomarcel

   
jpotelle reacted
ReplyQuote
Guido
(@admin)
Member Admin
Joined: 2 years ago
Posts: 179
 

@jpotelle Hi,

the new release 06.22.09.30 is available for download from my website.

In case you do not see the new release you may need to delete the browser's cache

Please give it a try

grafik

Regards

Guido

 

This post was modified 2 years ago by Guido

   
ReplyQuote
(@jpotelle)
Member
Joined: 2 years ago
Posts: 15
Topic starter  

It's working. Thank you! ? 

This post was modified 2 years ago by jpotelle

   
ReplyQuote
Share: