Forum > The Rest...

XMPie Remove Commas in VDP Line

(1/2) > >>

Slappy:
I know this is a Variable function I have to program, so this is the set of potential lines I'll have:


--- Quote ---<<TeachFirstName_1>> <<TeachLastName_1>>, <<COURSE_1>>, <<grade>>
<<TeachFirstName_2>> <<TeachLastName_2>>, <<COURSE_2>>, <<grade>>
<<TeachFirstName_3>> <<TeachLastName_3>>, <<COURSE_3>>, <<grade>>
<<TeachFirstName_4>> <<TeachLastName_4>>, <<COURSE_4>>, <<grade>>
<<TeachFirstName_5>> <<TeachLastName_5>>, <<COURSE_5>>, <<grade>>
<<TeachFirstName_6>> <<TeachLastName_6>>, <<COURSE_6>>, <<grade>>
--- End quote ---

Of course, not every student has ALL those teachers or courses, I need a Variable function to include/remove those commas after the <<TeachLastName>> and <<Course>> fields.

I tried the attached but not sure if I need to complete it to include ALL the iterations of Teachers/Courses or if I'm completely off.

 :banghead: :banghead: :banghead:

DCurry:
I've never used XMPie so I won't be much help with the nuts and bolts, but maybe can help with the logic. In the data, is 1 always populated, and if there are 2 teacher/courses, is it always going to be 1 and 2, or will it be random like possibly 3 and 6?

I use SmartStream and it has an easy way for me to tell it that if the variables are empty to not include any static copy on that line (like commas.)

scottrsimons:
I've never used XMPie either, but I use FusionPro and have used SmartStream at times along with GREP in InDesign. And I would write it so it places the ',' when the <<grade>> field is "TRUE" and another rule for when the <<COURSE_>> fields are "TRUE" too. And you may need to write a rule/equation for each of the 6 variables. Might take some time, but should be easy.

DCurry:
I'm thinking even simpler - if we can assume that if <TeachFirstName1 TeachLastName1> is populated then <Course1> and <Grade> are also populated, you could make 6 rules for the comma, but reuse each one twice in each line.
The comma rule would read that if <TeachFirstName1 TeachLastName1> is populated then return a comma. New rule for each line but you only need to consider if ONE of that line's fields is populated because if one is populate, they all should be.

Kinda like this:
<<TeachFirstName_1>> <<TeachLastName_1>><<commaRule1>> <<COURSE_1>><<commaRule1>> <<grade>>
<<TeachFirstName_2>> <<TeachLastName_2>><commaRule2>> <<COURSE_2>><commaRule2>> <<grade>>
<<TeachFirstName_3>> <<TeachLastName_3>><commaRule3>> <<COURSE_2>><commaRule3>> <<grade>>

pspdfppdfxhd:
Oh, this type of thing used to drive me nuts when it came up.

We had to get DesignMerge to handle this type of situation. I have not done one in a long time but it was, if i remember, simply adding a comma suffix to the variable then if other conditons were not met than deleting the whole thing. Something like that.

Navigation

[0] Message Index

[#] Next page

Go to full version