OL Learn

Populate numbers with text

I have a job where I need to have 23 song titles randomly populate 12 spaces on a card.

How do I for example let the software know what title is associated with a specific number.

For example 1= The prodigy & 2= U2 and so on.

I thought I would be able to make 1 Conditional to The Prodigy and so on.

All data is coming from the same excel doc.

Many Thanks

David Perrett

Ooops… I just saw you duplicated your post in the Connect PrintShop Mail forum, which means the following solution won’t work for you since you can’t use the DataMapper. Still, I will leave this answer here in case anyone else ever runs into a similar issue.

The easiest way is to add another column with the song index in your Excel sheet. Then you can extract each song title and the corresponding index value, and if the Excel sheet changes over time you won’t have to change anything (as long as each song has a corresponding index value)

However, if you have no control over the Excel sheet that your are being provided with, then your template (or your data mapping configuration) will have to conditionally look at each song title and match it to a specific, hard-coded index… but if the list of the songs changes, you`ll have to adjust your template/DM config.

In the DataMapper, for instance, you could create a Record property named songArray whose type you set to Object. Then you add an Action Step that sets the value of that object to an array containing all your songs, in indexed order:

["","The Prodigy","U2" ... ]
(the array starts with an empty value so that your actual songs start at index #1).

Then when you read the song name, you can “extract” its index to a new field set to Javascript mode by using the indexOf() method on your array:


This will extract the index of the song title inside the array you provided, or -1 if the song title can’t be found.