Switch.Counter ID

Post Reply
jterrano
Newbie
Posts: 6
Joined: Thu Nov 04, 2021 8:00 pm

Switch.Counter ID

Post by jterrano »

I am attempting to assign a counter to each PDF contained within a folder labeled with a job number.

(e.g. jobfolder: 1111111 contains 5 files : abc.pdf | def.pdf | ghi.pdf | jkl.pdf | mno.pdf

abc.pdf = 01
def.pdf = 02
ghi.pdf = 03
jkl.pdf = 04
mno.pdf = 05


My flow includes in the following order :

//Assign ID (job_number)
PrivateData set : job_number=[Job.NameProper]

//Ungroup Job
to split the PDFs from the folder

//Assign Counter
PrivateData set : counter=[Switch.Counter:Width="2",Id="job_number"]

but Switch continues to count each job that enters the flow regardless of the job_number

(e.g. job folder 2222222 contains 3 files : pqr.pdf | stu.pdf | vwx.pdf

pqr.pdf = 06
stu.pdf = 07
vwx.pdf = 08


...

can anyone explain what i am doing wrong?
freddyp
Advanced member
Posts: 1008
Joined: Thu Feb 09, 2012 3:53 pm

Re: Switch.Counter ID

Post by freddyp »

What you are doing wrong is that it is a Switch counter, not a job counter: it counts at the Switch level.

Here is a suggested flow. Use "Sort files in job" to add a prefix to all the files in the job folder; the numbering will be from 1 to x for every job. Ungroup the folder, you now have jobs with that prefix. Put that prefix in private data and rename the job to remove the prefix.
Post Reply