Change Month To A Letter 1=A, 2=B, 3=C Etc. S’abonner

0
Avatar
Legacy Poster

I need help creating a custom barcode for a customer. They require a custom date MYY but the month is not a number, it is a letter instead. So January 2016 will be A16 , February B16 etc.
 

I'm sure there is an easy VB script, but unfortunately that's not a language I speak.

Thank you for any assistance you can give.
 

5 commentaires

0
Avatar
Ian Cummings
Modérateur
Actions pour les commentaires Permalien

Under the "Transforms" tab of the month data source you could create 12 search and replace actions for each month of the year.

0
Avatar
Legacy Poster
Actions pour les commentaires Permalien

Thanks!  How do you enter the search and replace for months 10, 11 & 12?  I was getting "AA" for Nov. and AB for Dec.  There isn't a search and replace option when you select date from the Data Type tab. So I tried pulling in from the excel sheet I have linked and thought I had it but can't get the double digit month part figured out. I'm so close!

 

Thank you

0
Avatar
Ian Cummings
Modérateur
Actions pour les commentaires Permalien

Select the option to use a Regular Expression and do the search on ^12$ where the number represents the number of the month.  If your BarTender version doesn't support this then use VB script with a 12 case Select statement.

0
Avatar
Legacy Poster
Actions pour les commentaires Permalien

Ahh ok, I was missing the "^"

 

Working great now!

 

Thanks Ninja! :D

0
Avatar
Ian Einman
Actions pour les commentaires Permalien

If someone does want a VB Script to convert the month into a letter, here it is:

 

Mid("ABCDEFGHIJKL", Month(Date), 1)

 

You can use this as a single-line expression, and then just add a second data source of type Clock to get the YY part.

 

This works because the "Mid" function will take a substring of the first string, starting at the specified index (in this case the month as a number from 1-12) and of the specified length (1 character).  This same concept can be used to turn the weekday number into a letter as well:

 

Mid("UMTWRFS", Weekday(Date), 1)

Vous devez vous connecter pour laisser un commentaire.