• Toll-free  888-665-8637
  • International  +1 717-220-0012
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

nolax
#1 Posted : Tuesday, November 6, 2007 10:58:22 PM(UTC)
nolax

Rank: Member

Joined: 9/21/2004(UTC)
Posts: 97

Greetings:


This is a no brainer for most of the guys here but I need a little help on a VB code we are modifying based on the google analytics code so we can track Jellyfish Marketing Channel performance.



The code below is just a portion of the code but as you can see the loop will always append a pipe symbol to the end of string regardless of the line items. What we need is for the pipe to act as a delimiter to separate line items and as such should not be present at the end. We cannot move the sb.append("|") before the sb.Append(GoogleSafeString(li.ProductSku)) as it will put a pipe symbol before Item designator (I:) and the first item.



sb.Append("I:")
For Each li As BVSoftware.Bvc5.Core.Orders.LineItem In o.Items
sb.Append(GoogleSafeString(li.ProductSku))
sb.Append("|")
Next





The good output rendered will be:



i:item1|item2|item3



Thanks in advance.

Nolax
Marcus
#2 Posted : Tuesday, November 6, 2007 11:42:56 PM(UTC)
Marcus

Rank: Member

Joined: 11/5/2003(UTC)
Posts: 1,786

Instead of a for each loop you could do it like this:

Code:


sb.Append("I:")

For i as integer = 0 to o.Items.Count -1
sb.Append(GoogleSafeString(o.Items(i).ProductSku))
if i < o.items.count -1
sb.Append("|")
end if
End For

Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

©2025 Develisys. All rights reserved.
  • Toll-free  888-665-8637
  • International  +1 717-220-0012