Lasso Soft Inc. > Home

[Fedex_Shipping_Tracking_Script]

LinkFedex_Shipping_Tracking_Script
AuthorMarc Pope
CategoryTags
Version7.x
LicensePublic Domain
Posted16 Jan 2009
Updated16 Jan 2009
More by this author...

Description

This is not really a tag, but it is a simple solution to show Fedex tracking data. It shows all available data including the details.

Here is an example of the output: DEMO LINK

Tested on Lasso 7.x thru 8.5.6 on MacOS X. Should work on others.

Sample Usage

filename.lasso?trackNumb=999999999999

Source Code

Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.

			 //
// v1.0 - Created April 12, 2004									 //
//																	 //
// Free for personal/company use. Not for resale.				     //
// Required: Lasso Professional 7.x & Higher						 //
//																	 //
// This solution based on using the Fedex Tagged Transaction Format  //
//																	 //
// Download the Tagged Transaction Guide for more details:			 //
// www.fedex.com/us/solutions/wis/pdf/TagTransGuide.pdf?link=4		 //
//																	 //
// Thanks to the Lasso Community for ideas!							 //
//																	 //
///////////////////////////////////////////////////////////////////////



?>



Live Fedex Tracking Results: '+$trackNumb+'

'; // only get results if a tracking number is supplied. if: $trackNumb !=''; // build query for Fedex's Server var:'query'='0,"403"1534,"Y"1537,"' + $trackNumb + '"99,""'; // Get Tracking Data from Fedex // Note: It is recommended that you acquire a meter number from Fedex // although i'm not using one here and it still works.. so up to you. // Using the new PostParams tag to get results.. thanks BlueWorld! var:'result'= (Include_URL: 'https://gateway.fedex.com/GatewayDC', -POSTParams=$query); // Parse Results // Fedex returns a very strange pattern, so we'll make it work protect; $result = (String_Replace: $result, -Find=',"', -Replace='|||'); $result = (String_Replace: $result, -Find='"', -Replace='+++'); /protect; // build array of results var:'FDXArray'=(array); protect; var:'FDXArray'= $result->(Split:'+++'); /protect; // put the results array into a mapped array var:'FDXmap'=(map); loop: $FDXArray->(Size); var:'tempString'=$FDXArray->(get: (loopcount)); var:'tempArray'=$tempString->(Split:'|||'); var:'tempCode'=$tempArray->(Get:'1'); if:$tempArray->(size) > '1'; var:'tempResult'=$tempArray->(get:'2'); else; var:'tempResult'=''; /if; $FDXmap->(Insert: (var:'tempCode')=(var:'tempResult')); /loop; // display any errors from Fedex if: $FDXMap->(find: '3') != ''; '

'; $FDXMap->(Find: '3'); '
'; else; // now all the results are in a mapped array called $FDXMap // see the Fedex Tagged Transaction Guide for code references // make easy to read variables for the main ones var:'weight'=$FDXmap->(find:'1401-1'), 'weightdesc'=$FDXmap->(find:'75-1'), 'city'=$FDXmap->(find:'15-1'), 'state'=$FDXmap->(find:'16-1'), 'zip'=$FDXmap->(find:'17-1'), 'country'=$FDXmap->(find:'50-1'), 'UCN'=$FDXmap->(find:'1537-1-1'), 'orderNumber'=$FDXmap->(find:'1537-1-2'), 'packageID'=$FDXmap->(find:'1537-1-3'), 'tempSDate'=$FDXmap->(find:'24-1'), 'tempDDate'=$FDXmap->(find:'1720-1'), 'tempDTime'=$FDXmap->(find:'1707-1'), 'tempEDate'=$FDXmap->(find:'1339-1'), 'tempETime'=$FDXmap->(find:'1340-1'), 'tempRDate'=$FDXmap->(find:'1716-1'), 'tempRTime'=$FDXmap->(find:'1717-1'), 'serviceType'=$FDXmap->(find:'1704-1'), 'items'=$FDXmap->(find:'116-1'), 'signedFor'=$FDXmap->(find:'1706-1'), 'serviceCode'=$FDXmap->(find:'3025-1'); // parse expected delivered date // this part is messy, but it works.. sorry // need to rewrite using date tags var: 'expectedDate'='', 'expectedTime'=''; if: $tempEDate !=''; var: 'ExpectedDate'= $tempEDate->(substring: 5,2) + '/' + $tempEDate->(substring: 7,2) + '/' + $tempEDate->(substring: 1,4); /if; if: $tempETime !=''; var: 'ExpectedTime'= $tempETime->(substring: 1,2) + ':' + $tempETime->(substring: 3,2) + ':' + $tempETime->(substring: 5,2); /if; var: 'reattemptDate'='', 'reattemptTime'=''; if: $tempRDate !=''; var: 'ReattemptDate'=$tempRDate->(substring: 5,2) + '/' + $tempRDate->(substring: 7,2) + '/' + $tempRDate->(substring: 1,4); /if; if: $tempRTime !=''; var: 'ReattemptTime'=$tempRTime->(substring: 1,2) + ':' + $tempRTime->(substring: 3,2) + ':' + $tempRTime->(substring: 5,2); /if; // parse delivered date var: 'deliveryDate'='', 'shipdate'='', 'deliveryTime'=''; if: $tempDDate !=''; var: 'DeliveryDate'= $tempDDate->(substring: 5,2) + '/' + $tempDDate->(substring: 7,2) + '/' + $tempDDate->(substring: 1,4); /if; if: $tempDTime !=''; var: 'DeliveryTime'= $tempDTime->(substring: 1,2) + ':' + $tempDTime->(substring: 3,2) + ':' + $tempDTime->(substring: 5,2); /if; if: $tempSDate !=''; var: 'ShipDate'= $tempSDate->(substring: 5,2) + '/' + $tempSDate->(substring: 7,2) + '/' + $tempSDate->(substring: 1,4); /if; // build a table of the info, modify as you wish // note: not all fields are always populated '
Package Weight: ' + $weight + $weightDesc ' Location: ' + $city + ', ' + $state + ' ' + $zip + '
UCN: ' + $UCN + ' Country: ' + $country + '
Order #: ' + $OrderNumber + ' Package ID: ' + $PackageID + '
Ship Date: ' + $ShipDate + ' Delivered On: ' + $DeliveryDate + ' ' + $DeliveryTime + '
Reattempt Date: ' + $reattemptDate + ' ' + $reattemptTime + ' Expected Date: ' + $expectedDate + ' ' + $expectedTime + '
Service Type: ' + $serviceType + ' Signed For: ' + $signedFor + '
Service Code: ' + $serviceCode + ' Items: ' + $items + '

'; // now build scan history into some pretty tables // 1715-1 contains the number of scan history lines var:'historyItems'=integer:($FDXmap->(find:'1715-1')); if: $historyitems > 0; ''; ''; ''; ''; ''; ''; ''; ''; ''; ''; ''; loop: $historyitems; var: 'scanCode' = $FDXmap->(find: ('1171-1-'+(loopcount))); var: 'scanMsg' = $FDXmap->(find: ('1159-1-'+(loopcount))); var: 'scanCity' = $FDXmap->(find: ('1160-1-'+(loopcount))); var: 'scanState' = $FDXmap->(find: ('1161-1-'+(loopcount))); var: 'scanCountry' = $FDXmap->(find: ('1164-1-'+(loopcount))); var: 'scanDate' = $FDXmap->(find: ('1162-1-'+(loopcount))); var: 'scanTime' = $FDXmap->(find: ('1163-1-'+(loopcount))); var: 'scanComments'= $FDXmap->(find: ('1711-1-'+(loopcount))); // reformat date if: $scanDate !=''; var:'tempScanDate'= $scanDate; var: 'ScanDate'= $tempscanDate->(substring: 5,2) + '/' + $tempscanDate->(substring: 7,2) + '/' + $tempscanDate->(substring: 1,4); /if; // reformat time if: $scanTime !=''; var:'tempScanTime'= $scanTime; var: 'ScanTime'= $tempscanTime->(substring: 1,2) + ':' + $tempscanTime->(substring: 3,2) + ':' + $tempscanTime->(substring: 5,2); /if; ''; ''; ''; ''; ''; ''; ''; ''; ''; ''; /loop; '
'+ 'Scan Date' +''+ 'Scan Time' +''+ 'Code' +''+ 'Message' +''+ 'City' +''+ 'State' +''+ 'Country' +''+ 'Comment' +'
'+ $scanDate +''+ $scanTime +''+ $scanCode +''+ $scanMsg +''+ $scanCity +''+ $scanState +''+ $scanCountry +''+ $scanComments +'
'; /if; /if; /if; ?>

Comments

No comments

Please log in to comment

Subscribe to the LassoTalk mail list

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft