In case they do, it would be nice to have a free format text block in the IDE editor.
The editor is VERY demanding with its spacing and indention which makes dealing with large complex string (like when using select_sql) very difficult.
For example take this query that unions data from two different (but structurally same) libraries:
Code: Select all
#lSql := ("select BDBC, BDFTYP, BDFR, case when Month = 1 then sum(GM) end as JAN, case when Month = 2 then sum(GM) end as FEB, case when Month = 3 then sum(GM) end as MAR, case when Month = 4 then sum(GM) end as APR, case when Month = 5 then sum(GM) end as MAY, case when Month = 6 then sum(GM) end as JUN, case when Month = 7 then sum(GM) end as JUL, case when Month = 8 then sum(GM) end as AUG, case when Month = 9 then sum(GM) end as SEP, case when Month = 10 then sum(GM) end as OCT, case when Month = 11 then sum(GM) end as NOV, case when Month = 12 then sum(GM) end as DEC from ( select BDBC, BDFTYP, BDFR, month(date(timestamp_format(char(BDDWP),'YYYYMMDD'))) as Month, sum(BDGMA) as GM from &1.AF1220 where BDOFID in (select OFID from &1.XF1102E where ELVL = 0 and ZONE = &3) and BDELVL = 0 and BDDWP > &4 and BDDWP <= &5 group by BDBC, BDFTYP, BDFR, month(date(timestamp_format(char(BDDWP),'YYYYMMDD'))) union all select BDBC, BDFTYP, BDFR, month(date(timestamp_format(char(BDDWP),'YYYYMMDD'))) as Month, sum(BDGMA) as GM from &1.AF1220 where BDOFID in (select OFID from &2.XF1102E where ELVL = 0 and ZONE = &3) and BDELVL = 0 and BDDWP > &4 and BDDWP <= &5 group by BDBC, BDFTYP, BDFR, month(date(timestamp_format(char(BDDWP),'YYYYMMDD')))) a group by BDBC, BDFTYP, BDFR, Month order by BDBC, BDFTYP, BDFR").Substitute( #lUSDataLibrary #lCADataLibrary #wk_Zone.AsString #wk_StartDate.AsString #wk_EndDate.AsString )
What I would like to see is a text block capability so that query could be formatted into a more manageable form.
For example:
Code: Select all
#lSql :=( `
select BDBC, BDFTYP, BDFR,
case when Month = 1 then sum(GM) end as JAN,
case when Month = 2 then sum(GM) end as FEB,
case when Month = 3 then sum(GM) end as MAR,
case when Month = 4 then sum(GM) end as APR,
case when Month = 5 then sum(GM) end as MAY,
case when Month = 6 then sum(GM) end as JUN,
case when Month = 7 then sum(GM) end as JUL,
case when Month = 8 then sum(GM) end as AUG,
case when Month = 9 then sum(GM) end as SEP,
case when Month = 10 then sum(GM) end as OCT,
case when Month = 11 then sum(GM) end as NOV,
case when Month = 12 then sum(GM) end as DEC
from (
select BDBC,
BDFTYP,
BDFR,
month(date(timestamp_format(char(BDDWP),'YYYYMMDD'))) as Month,
sum(BDGMA) as GM
from &1.AF1220
where BDOFID in (select OFID from &1.XF1102E where ELVL = 0 and ZONE = &3)
and BDELVL = 0
and BDDWP > &4
and BDDWP <= &5
group by BDBC, BDFTYP, BDFR, month(date(timestamp_format(char(BDDWP),'YYYYMMDD')))
union all
select BDBC,
BDFTYP,
BDFR,
month(date(timestamp_format(char(BDDWP),'YYYYMMDD'))) as Month,
sum(BDGMA) as GM
from &1.AF1220
where BDOFID in (select OFID from &2.XF1102E where ELVL = 0 and ZONE = &3)
and BDELVL = 0
and BDDWP > &4
and BDDWP <= &5
group by BDBC, BDFTYP, BDFR, month(date(timestamp_format(char(BDDWP),'YYYYMMDD')))
) a
group by BDBC, BDFTYP, BDFR, Month
order by BDBC, BDFTYP, BDF
`).Substitute( #lUSDataLibrary #lCADataLibrary #wk_Zone.AsString #wk_StartDate.AsString #wk_EndDate.AsString )
It could be argued that this particular query should be turned into a View, but for reasons beyond this discussion it cannot, and merely serves as an example of complex strings in the IDE.
Thoughts?
Joe