Copy link to clipboard
Copied
Hi all,
I've got some code that validats and cleans data that a client will upload. It works in 3 phases and I've got 4 separate files to process the data - the first initialises everything. Phase 2 needs to repeat itself until their are no more validation errors (the initial sweep will remove some errors, which in turn may result in more errors, due to data dependencies). I am using CFLOCATION to move between the phases once each is complete.
This works fine in the browser, but I want to run it as a Scheduled task, but when I run it as such, the CFLOCATIONS don't work
This is the basic setup
Initialisation ---- cflocates to phase1
Phase1 ---- cflocates to phase 2
Phase 2 ---- IF no errors, then cflocate to Phase3, else cflocate back to Phase2 for another sweep with a URL param to indicate it's not the 1st pass
Phase3 ---- all done.
Anyone have any ideas how I can achieve this if cflocation won't work? I know I could set up each phase as a separate task and execute them at the end of the previous one, but the second and subsequent sweeps in phase 2 need to generate a different error, hence the URL param...?
Any help would be gratefully received!
Thanks
Phil
Sorted it. I set them up as three separate scheduled tasks and they run each other upon completion, with the looped one running itself until error free.
Copy link to clipboard
Copied
A cflocation in a scheduled task doesn't sound right to me (I've never used that set-up). Scheduled tasks are normally things run on a regular basis, like automated processes. You should really bundle all your code together in one template, or perhaps cfinclude it. If you need to pass parameters, do it using cfhttp and cfhttpparam perhaps, and call the templates that way. Cflocating to some other template because you want to run it in isolation sounds a bit clunky - this is a code logic issue I think.
Copy link to clipboard
Copied
Sorted it. I set them up as three separate scheduled tasks and they run each other upon completion, with the looped one running itself until error free.
Copy link to clipboard
Copied
Yep, cflocation sounded wrong for this.