I have the following tables to be downloaded in CFMX. The actual table names are:
Demo
FuncAbility
GatekeeperVisit
HealthStatus
HospitalVisit
Institutation
Insurance
Intake
PhoneTrack
PsychSocialCognitive
Services
What I am trying to do:
?? question ==> need to do cfloop for all tables above mentioned:
<CFQUERY NAME="ExportData" DATASOURCE="Gkeeper">
SELECT *
FROM tablename
</CFQUERY>
<CFSET tempfile = "C:\temp\exptemp.csv">
<CFSET output = "">
?? question ==> there are many filed (column) names, so I like to do cfloop so that I don't need to hard-code all fields.
<CFSET output = output & "field1 field2 field3">
<CFFILE ACTION="WRITE"
FILE="#tempfile#"
OUTPUT="#output#">
<CFLOOP QUERY="GetList">
<CFSET output = "">
?? question ==> I like to do cfloop so that I don't need to hard-code all fields.
<CFSET output = output & "#field1# #field2# #field3#>
<CFFILE ACTION="APPEND"
FILE="#tempfile#"
OUTPUT="#output#">
</CFLOOP>
<CFCONTENT TYPE="application/excel" FILE="#tempfile#">
and then
<CFMAIL>
?? question: e-mail new .XLS files
</CFMAIL>
?? question: remove all .XLS files so that always new .XLS files can be downloaded and e-mailed.
Please advice.
thx much
Demo
FuncAbility
GatekeeperVisit
HealthStatus
HospitalVisit
Institutation
Insurance
Intake
PhoneTrack
PsychSocialCognitive
Services
What I am trying to do:
?? question ==> need to do cfloop for all tables above mentioned:
<CFQUERY NAME="ExportData" DATASOURCE="Gkeeper">
SELECT *
FROM tablename
</CFQUERY>
<CFSET tempfile = "C:\temp\exptemp.csv">
<CFSET output = "">
?? question ==> there are many filed (column) names, so I like to do cfloop so that I don't need to hard-code all fields.
<CFSET output = output & "field1 field2 field3">
<CFFILE ACTION="WRITE"
FILE="#tempfile#"
OUTPUT="#output#">
<CFLOOP QUERY="GetList">
<CFSET output = "">
?? question ==> I like to do cfloop so that I don't need to hard-code all fields.
<CFSET output = output & "#field1# #field2# #field3#>
<CFFILE ACTION="APPEND"
FILE="#tempfile#"
OUTPUT="#output#">
</CFLOOP>
<CFCONTENT TYPE="application/excel" FILE="#tempfile#">
and then
<CFMAIL>
?? question: e-mail new .XLS files
</CFMAIL>
?? question: remove all .XLS files so that always new .XLS files can be downloaded and e-mailed.
Please advice.
thx much