TheLazyPig
Programmer
Can I use TEXT... ENDTEXT inside a DO CASE statement?
The data I'm retrieving is from an oracle db.
I tried IF statement it won't work so I used CASE but still have error.
The error points to COPY TO line..
Before I use the DO CASE statement it works.
Below is my query for OK button in DO CASE.
grpFYRenewal is the name of Radio Button.
Thank you!
The data I'm retrieving is from an oracle db.
I tried IF statement it won't work so I used CASE but still have error.
The error points to COPY TO line..
Code:
IF SQLEXEC(gnHandle, lcSQL , 'MyCursor') > 0
COPY TO (lcDir+"HP_Summary_per_Account\lcMonth+"_HP_Extraction_perAccount") TYPE XLS
MESSAGEBOX("File ["+lcMonth+"_HP_Extraction_perAccount.xls] Created!")
ELSE
Before I use the DO CASE statement it works.
Below is my query for OK button in DO CASE.
grpFYRenewal is the name of Radio Button.
Code:
DO CASE
CASE thisform.grpFYRenewal.value = 1
lcSql = ""
TEXT TO lcSQL TEXTMERGE NOSHOW
SELECT CASE
WHEN poltype=30001 THEN 'Individual'
WHEN poltype=30003 THEN gen.refdesc
END AS ACCNT_GRP,plangrp,COUNT(plandesc) AS PLAN_COUNT
,SUM(basicprem) AS PREMIUM
FROM xag_prod_summary prd
LEFT JOIN inb_moamst moa ON moa.moa_seqno = prd.moaseqno
LEFT JOIN cxx_geninfo_ref gen ON gen.refseqno = moa.market_segment
WHERE TO_CHAR(prd.referencedate,'YYYYMM') = ?dDate
AND prd.plangrp IN ('HPSP','HPSD','FHIPP','FHIPD','HRPD','FLHP','HPNP','HPND','HPWP','HPWD','HDRP','HDRD','HDSP','HRSD','HRPP','HRPD','HPSP','HPSD','HRFD')
AND policyyear = 1
GROUP BY gen.refdesc,prd.plangrp,prd.poltype
ORDER BY 1
ENDTEXT
CASE thisform.grpFYRenewal.value = 2
lcSql = ""
TEXT TO lcSQL TEXTMERGE NOSHOW
SELECT CASE
WHEN poltype=30001 THEN 'Individual'
WHEN poltype=30003 THEN gen.refdesc
END AS ACCNT_GRP,plangrp,COUNT(plandesc) AS PLAN_COUNT
,SUM(basicprem) AS PREMIUM
FROM xag_prod_summary prd
LEFT JOIN inb_moamst moa ON moa.moa_seqno = prd.moaseqno
LEFT JOIN cxx_geninfo_ref gen ON gen.refseqno = moa.market_segment
WHERE TO_CHAR(prd.referencedate,'YYYYMM') = ?dDate
AND prd.plangrp IN ('HPSP','HPSD','FHIPP','FHIPD','HRPD','FLHP','HPNP','HPND','HPWP','HPWD','HDRP','HDRD','HDSP','HRSD','HRPP','HRPD','HPSP','HPSD','HRFD')
AND policyyear > 1
GROUP BY gen.refdesc,prd.plangrp,prd.poltype
ORDER BY 1
ENDTEXT
ENDCASE
Thank you!