Strip out spaces from tracking number

So I ran across the tracking details button and saw that I could set up a url to go check the actual tracking. Cool! However, shipping personally have been using spaces to enter them (because they are easier to read) and so when I click on the button, it brings the spaces with as %, so the site won’t take it.

Is there a way to set this up to strip out the spaces before it’s passed to the URL? I tried running a trace on the button and can only get the URL and <EpicorTrackingNumber> out of anything on a BPM.

image

Replace the button with your own and call this on click

var sh = oTrans.Factory("ShipHead");
if(sh.Row>=0)
    oTrans.AccessShipViaWebSite(oTrans.CartonTrackNbr.Replace(" ",""));
3 Likes

Ah, I’m glad to see replace in C# too. I had to use it on order comments in a BAQ to remove “special” characters so had to embed/nest it inside itself:

(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace( OrderHed.OrderComment , char(9), ' '), char(10), ''), char(13), ''), char(30), ' '), char(128), ''), char(145), ''), char(146), ''), char(147), ''),char(148), ''), char(149), ''), char(150), ''), char(151), ''), char(156), ''), char(160), ''), char(183), ''), char(226), '')

Char map:
9 Tab
10 Line feed
13 Carriage Return
30 Record Separator
128 Euro Sign
145 left single quotation mark
146 right single quotation mark
147 left double quotation mark
148 right double quotation mark
149 bullet
150 en dash
151 em dash
156 small ligature oe
160 no-break space
183 middle dot
226 small a with circumflex

This might work too:

Regex.Replace(input, @"[^\u0021-\u007E\u00A0-\u00FF]", string.Empty);

It should keep only the characters above 20 to A0. See character set below:

https://chars.suikawiki.org/set?expr=[\u0020-\u007E]

Mark W.

1 Like

found an interesting dialog on cleaning up a string with c# here… seems there are many ways to do this: c# - Most efficient way to remove special characters from string - Stack Overflow

Any way to not need C#? I will try out Jose’s fix, but it seems like this would be a common this to be built into E-10, since most people put the spaces in there for readability, and when you paste it into the carrier website, it removes them on it’s own.

I mean you could remove them on post processing on GetByID on a BPM… but then it wouldn’t be readable

So what about getting a carriage return to handle multiple tracking number (say for different boxes.) Generally, I know it should be different packing slip numbers, but of course, my users like to be difficult. :man_facepalming:

first call .Trim() on the string to get rid of leading and trailing spaces, then replace spaces as shown above with /r/n (instead of “”) might work

It needs to be in the URL for the website. More a UPS question than an Epicor question. I tried <br> between tracking number and <cr> and neither of those worked.

Oh…yea, i dont think the UPS api supports it - but it’s worth confirming

If it was worth your while, you could create your own web api to generate a webpage with clickable links for each one back to UPS. For that matter, you maybe could even write your api to call UPS and just display them all one page you create.

May have to play around with that there seems to be a similar command in TSQL

Hi, My name is Brandon, we must not have met before! :joy:

No way I can get that working.

I do notice on their site, you can load in more than one at a time and the URL simply has a space in it.

Then doing some googling and trial and error, if I put %0D between the tracking numbers, it will load the site (with and error, but just click through that…) and have both tracking numbers.

So I can use Jose’s trick and replace spaces first, then replace , with %0D and they (the end user) can separate them with a comma.

2 Likes