Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
multiple run throughs of .wft
System
Question:
I know that the .wft in a workflow is processed a few times so if you have perl in the .wft, it will get run at least twice (once before initial display and then again when run job is clicked).
But it turns out it seems like the perl code seems to run twice, not once, on initial display.
You can see this easily using a minimal test program
The important part is here:
<template_script><![CDATA[
open(FH, ">> /runtest.txt");
print FH "template script running\n";
close(FH);
Run the template and before running the job, examine the file it creates
(you might have to change the path to somewhere you have create and write
permission). you will see that 2 lines are present.
Another is added after you run the job. Others are added if the form is
submitted but cant run the job due to input validation errors eg if user
didnt enter any data.
-------------------------------
The problem is that I need to distinguish between all these
runs:
- the first run before the initial display
- the second run before the initial display
- successful submission
- submissions that go back to the user because of input error
Is there a way to tell which run it is? I thought it was only run once before initial display and then run once after successful submission so i was thinking to just see if the form values are set (after initial display) to distinguish between the 2 runs. But now it looks like there are multiple runs. Is there a reason for this?
thanks, yi-ling
Find more posts tagged with
Comments
Migrateduser
Out of curiosity, why do you need that level of granularity? Why do you need to distinguish between the passes of the wft file? If you merely needed to know when your TAG_info attributes are filled in, you could simply test for whether they contain any data.
Dave Smith
Sr. Software Engineer
Nike, Inc.
(503) 671-4238
DavidH.Smith@nike.com
Migrateduser
I have the same problem. The Perl in my .wft has to call Java to populate a drop-down using a command line that is relatively expensive. I would like to avoid this if possible, but other than creating some hack like a temp file or environment variable there doesn't seem to be a way.
Migrateduser
I just tried with an environment variable (check it, do what should only be done on the first or second pass based on whether it is defined, then set it) and that seems to work. Note that it actually gets parsed at least three times - two before the workflow instantiation form appears, and at least once when the job is submitted. If you view source on the instantiation page there is a variable that should indicate which pass it is on, but I am not sure it is reliable (for now I use the presence of job description to determine if it is the third pass). But on the last project I was on there were no required fields on the workflow instantiation form (job description was optional). In this case (or if all required fields had default values) the user would never get the chance to fill out the form - it would just go straight to creating the job. To get around this I did the attached.
peklo
What is the name of the variable that indicates which pass its on?
Thanks
Adam Stoller
I finally found the phrase to search on for the forums:
iw_first_time
Use that in the Forum Search - and you should get at least 20 hits - and there should be at least 3 informative ones ;-)
(I knew the data was there somewhere I just kept trying "first_pass", "firstpass" instead of "first_time")
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com