Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Redirect in Non-Executed Code

Engaged ,
Mar 24, 2008 Mar 24, 2008
I have a scheduled task that calls the page: Reports/kpi/random_report_requests.cfm (just like that, copied the extension from CF Administrator)

I start the code like this:
<cfif not isDefined("test")>
<cfset test = 1>
</cfif>

And during the scheduled task everything works fine until this block of code:
<cfif not test>
<cflocation url="../dgim/ap_performance.cfm">
</cfif>

The page is redirected to ap_performance.cfm and those processes are run. Does cflocation override procedural code? This is in CF4.5

Thanks!

TOPICS
Getting started
331
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Mar 24, 2008 Mar 24, 2008
In your case it looks like test = 1

In the code <cfif not test> it returns 0 and your include must not work.

If it works this would be because of the version of CF and handling the cfif block.

I would suggest to put direct reference and compare with 1 as

<cfif test NEQ 1>

I hope this helps.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 24, 2008 Mar 24, 2008
Oguz, thank you for your reply, but I use this syntax regularly and have never had an issue like this, but I have never called cflocation inside a statement like that either.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Mar 24, 2008 Mar 24, 2008
LATEST
I know there are already some issues with CFlocation but this is something weird.

You can try to use JavaScript for page forwarding instead of cflocation.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources