Recent

Author Topic: XMPie Remove Commas in VDP Line  (Read 466 times)

0 Members and 1 Guest are viewing this topic.

Offline Slappy

  • Ninja Member
  • *
  • Posts: 4311
  • Gender: Male
  • Come On. Fhqwhgads.
XMPie Remove Commas in VDP Line
« on: December 31, 2020, 01:23:40 PM »
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>>

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:
« Last Edit: December 31, 2020, 02:59:01 PM by Slappy »
A little diddie ‘bout black 'n cyan...two reflective colors doin’ the best they can.

Offline DCurry

  • Ninja Member
  • *
  • Posts: 1899
  • Gender: Male
  • They're real, and they're spectacular.
Re: XMPie Remove Commas in VDP Line
« Reply #1 on: January 04, 2021, 11:03:46 AM »
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.)
Prinergy 8.4.1.45 • Preps 8 (Not a fan) • SmartStream Designer

Build a man a fire, and he'll be warm for a night. But set a man on fire, and he'll be warm for the rest of his life!

Offline scottrsimons

  • Prepress/IT/Automation
  • Sr. Member
  • ****
  • Posts: 395
  • Gender: Male
  • 42
Re: XMPie Remove Commas in VDP Line
« Reply #2 on: January 05, 2021, 08:09:20 AM »
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.
Mac • Prinergy 8 • Preps 8 • RBA • Fusion Pro

"Your superior intellect is no match for our puny weapons!" - Homer J. Simpson

<!--"If you don't do anything you can't screw anything up." Joe-->

Offline DCurry

  • Ninja Member
  • *
  • Posts: 1899
  • Gender: Male
  • They're real, and they're spectacular.
Re: XMPie Remove Commas in VDP Line
« Reply #3 on: January 05, 2021, 08:20:32 AM »
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>>
Prinergy 8.4.1.45 • Preps 8 (Not a fan) • SmartStream Designer

Build a man a fire, and he'll be warm for a night. But set a man on fire, and he'll be warm for the rest of his life!

Offline pspdfppdfxhd

  • Ninja Member
  • *
  • Posts: 2824
  • Gender: Male
Re: XMPie Remove Commas in VDP Line
« Reply #4 on: January 05, 2021, 11:20:50 AM »
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.


Offline Slappy

  • Ninja Member
  • *
  • Posts: 4311
  • Gender: Male
  • Come On. Fhqwhgads.
Re: XMPie Remove Commas in VDP Line
« Reply #5 on: January 05, 2021, 05:27:33 PM »
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>>

Pretty similar to what Lammy on here gave me, I still get "rogue" commas and data though and I gave up trying to get a clean formula. Passed it off to our in-house Mail Guru and he knocked out the 38,000 records in no time.
He ended up adding the comma as its own field, by sorting the records that only needed it, pretty crafty & not something I would have tried with a data set this long.
A little diddie ‘bout black 'n cyan...two reflective colors doin’ the best they can.