Jump to content

Calculate number of particular fields


Recommended Posts

I have a repeating job that is producing sets of contact sheets for images. It is a single page with 8 graphic frames and a hidden text frame, then an overflow page of the same format. One time I will get a set of data that has fields named "Field 1" to "Field 56". This will result in a pdf of 7 pages with 8 images each per record. Next time, I will get data that is "Field 1" to "Field 98", which would need 13 pages per record.


What I am currently doing in my rule that is triggering the activation of my overflow pages is manually entering the quantity for all the rules that start with "Field ". What I am wondering is if it is possible to automate this count so I no longer have to edit this rule every time.


Just wondering....

Link to comment
Share on other sites

Well, I would set up the job a bit differently, to have just the single body page and repeat it, instead of using Overflow pages. But for what you're doing, if you want to count the number of fields, you can just do something like this:

for (numFields = 0; ; numFields++)
       Field("Field " + (numFields + 1));
   catch (e)

// Now numFields is set to the number of fields named "Field x", where "x" is a number, in the job.
// So do something here with numFields, such as returning it, for example:
return numFields;

This can be done in either OnRecordStart or OnJobStart.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...