[Solved] Code formatting fails

5 Posts
2 Users
0 Reactions
1,073 Views
Posts: 16
Topic starter
(@jpotelle)
Member
Joined: 4 years ago
[#47]

This bit of code fails to format correctly in SQLinForm, mostly at the bottom.

Select
Cast( Sum( Cast (
Case
When CLMS.APA_CD in ( 1 , 2 )
Then Coalesce( Cast( CLMS.DC_AMT_AGG as DECIMAL(30,8)) ,0) -
Coalesce( Cast( CLMS.APA_RDCTN_AMT_AGG as DECIMAL(30,8)) ,0)
Else Coalesce( Cast( CLMS.DC_AMT_AGG as DECIMAL(30,8)) ,0)
End as DECIMAL(30,8)) ) as DECIMAL(30,8)) as DC_AMT_AGG_APA
From TABLE1 as CLMS
Left Join TABLE2 as DC_E
On CLMS.PERF_YEAR = DC_E.PERF_YEAR and CLMS.DCE_ID = DC_E.DCE_ID
Where CLMS.FIN_ELIG = 1
Group By CLMS.PERF_YEAR, CLMS.CLNDR_YR


4 Replies
Guido
Posts: 295
Admin
(@admin)
Member
Joined: 5 years ago

Hi jpotelle,

which DB did you choose in the General option?

Formatting your SQL gives this result.

grafik

Could you please point me to the formatting problem

 

Thx

Guido


Reply
1 Reply
(@jpotelle)
Joined: 4 years ago

Member
Posts: 16

@admin TERADATA, below is formatting results

See the end of the CASE, the formatting trouble happens at FROM

Select
  Cast(
  Sum(
  Cast (
    Case
      When CLMS.APA_CD in ( 1
                        , 2 )
        Then Coalesce( Cast( CLMS.DC_AMT_AGG as     DECIMAL(30,8)) ,0) -
          Coalesce( Cast( CLMS.APA_RDCTN_AMT_AGG as DECIMAL(30,8)) ,0)
      Else Coalesce( Cast( CLMS.DC_AMT_AGG as       DECIMAL(30,8)) ,0)
    End as                                          DECIMAL(30,8)) ) as DECIMAL(30,8)) as DC_AMT_AGG_APA From TABLE1 as
          CLMS Left Join TABLE2 as DC_E On CLMS.PERF_YEAR = DC_E.PERF_YEAR
          and CLMS.DCE_ID                                 = DC_E.DCE_ID Where CLMS.FIN_ELIG = 1 Group By
          CLMS.PERF_YEAR, CLMS.CLNDR_YR

Reply
Guido
Posts: 295
Admin
(@admin)
Member
Joined: 5 years ago

thx!

This is what I get using N++ 8.4.6 with SQLinForm 6.22.10.07

I imported your profile

grafik

Do you have some speciel white space chars before the "FROM" character?

Anyway I will think about this issue.

Regards


Reply
Posts: 16
Topic starter
(@jpotelle)
Member
Joined: 4 years ago

Ah, I forgot how frequently your plugin is updated.  I updated NP++ to v8.4.6 (from v8.4.5), no joy. Then I updated SQLinForm to 6.22.10.04 (from 6.22.09) and this fixed the problem. Thanks!


Reply
Share: