Is it possible to convert the shipment number to a letter? For example if we have shipment numbers 1, 2, ... can we display that as A, B, ... using nVelocity in the vendor notification email template?
Thanks in advance.
nVelocity - Convert Shipment Number to Letter
- Logan Rhodehamel
- Developer
- Posts: 4116
- Joined: Wed Dec 10, 2003 5:26 pm
Re: nVelocity - Convert Shipment Number to Letter
With nVelocity, usually the answer is yes. Toward the top find little code like:
Then change it to this:
Then a few lines down it shows the shipment label (like 1 of 2). Change that to this:
So basically, I created a string variable then accessed the substring property. Warning, if you get more than 26 shipments in an order it will break.
Code: Select all
#set ($shipNo = 1)
Code: Select all
#set ($shipLetters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ")
#set ($shipNo = 0)
Code: Select all
<strong><u>Shipment ${shipLetters.Substring($shipNo, 1)}</u></strong>
Cheers,
Logan
.com
If I do not respond to an unsolicited private message, it's not because I'm ignoring you. It's because the answer to your question is valuable to others. Try the new topic button.
Logan

If I do not respond to an unsolicited private message, it's not because I'm ignoring you. It's because the answer to your question is valuable to others. Try the new topic button.
Re: nVelocity - Convert Shipment Number to Letter
Thank you Logan. I couldn't find a list of nVelocity String functions so I didn't know what I had to work with. Given substring, yours is the obvious solution. Thanks again.
- Logan Rhodehamel
- Developer
- Posts: 4116
- Joined: Wed Dec 10, 2003 5:26 pm
Re: nVelocity - Convert Shipment Number to Letter
In some ways it helps to think of nVelocity as .NET compiler - you get the full range of .NET methods and properties for any variable. Sometimes the trick is figuring out how to get the variable. Since I know we can create a string variable using the nVelocity set command, that would give you access to all of these:
http://msdn.microsoft.com/en-us/library ... mbers.aspx
http://msdn.microsoft.com/en-us/library ... mbers.aspx
Cheers,
Logan
.com
If I do not respond to an unsolicited private message, it's not because I'm ignoring you. It's because the answer to your question is valuable to others. Try the new topic button.
Logan

If I do not respond to an unsolicited private message, it's not because I'm ignoring you. It's because the answer to your question is valuable to others. Try the new topic button.