Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to use variable substitutions in CFSchedule

Status
Not open for further replies.

ruxshin

Programmer
Apr 26, 2001
33
FI
How do I substitute these CF variables into the CFschedule tag?

<cfset mytask = #form.taskname#>
<cfset mystartdate = #form.startdate#>
<cfset mystarttime = #form.starttime#>
<cfset myurl = #form.myurl#>
<cfset myfile = #form.filename#>
<cfset mypath = #form.filepath#>

Are the substitutions below correct?

<cfschedule action=&quot;UPDATE&quot;
task=&quot;#mytask&quot;
operation=&quot;HTTPRequest&quot;
url=&quot;#myurl#&quot;
startdate=&quot;#mystartdate#&quot;
starttime=&quot;#mystarttime#&quot;
interval=&quot;daily&quot;
resolveurl=&quot;Yes&quot;
publish=&quot;Yes&quot;
file=&quot;#myfile#&quot;
path=&quot;#mypath#&quot;>

I'm confused about whether to use <cfoutput>#variable_name#</cfoutput> or just #variable_name#.
Can anyone explain?
 
Hey Ruxshin,

I know how you feel, the <CFouput ... or not dellima is a tough one. In this case you don't need a <CFOUTPUT> You only need <CFoutput> when ColdFusion Variables are dealing with HTML code or JavaScript (like inside a <Form> tag).

You don't need it inside any call to CF. That seems like an easy rule but I still find myself getting it wrong sometimes. But CF will let you know if it is wrong. :)

Hope it helps. Is the above code not working? I see a type-o type problem that might be causing you stress:

task=&quot;#mytask&quot;

That should be:

task=&quot;#mytask#&quot;

Other then that the code looks good.
 
Hi tlhawkins,

The above code is working, but after several testings, this is also acceptable:

<cfschedule action=&quot;UPDATE&quot;
task=#mytask#
operation=&quot;HTTPRequest&quot;
url=#myurl#
startdate=#mystartdate#
starttime=#mystarttime#
interval=&quot;daily&quot;
resolveurl=&quot;Yes&quot;
publish=&quot;Yes&quot;
file=#myfile#
path=#mypath#>

We actually do not need the double quotes when we use a CF variable as the value of an attribute in a CF tag, unless the variable is inside a string:

eg: <cfschedule action=&quot;update&quot;
task=&quot;mytask#tasknumber#&quot; etc.>

Anyway, although the codes are correct, my task still won't run on the scheduled time. Frustrating!

Ruxshin

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top