ResellerFinder
ResellerFinder.asmx
This
web service provides a method to return customers or ship-to based on the
distance of a zip code. This can be useful in situations when consumers try to
find the nearest store where they can purchase your products. The distance is calculated based on the
latitude and longitude values in the zip code table. The latitude and longitude
in the zip code table represent the geographic location center of the zip code area.
Therefore, the calculated distance of a customer or ship-to to a particular zip
code is not 100% correct. But it is good
enough for most situations.
This method uses a relational engine to execute SQL commands and retrieve customers or ship-to based on a zip code in a certain distance range.
Usage:
FindResellerResult = A.FindResller(UserName, UserPassword, ZipCode, MaxDistance, LocationDataSource, ActiveCustomerOnly, GetAttribute, AttributeWebFlag, GetNotes, NotesWebFlag, GetLinks, GetEcontact, OrderBy, AdditionalWhere, ShipToAdditionalWhere)
Parameters
UserName and UserPassword are not used at this moment.
Input Parameter
Parameter |
Type |
Detail |
zipCode |
String |
Required. Must be a valid 5-digit zip code in the United States. |
maxDistance |
Double |
Required. Indicates the return customer or ship-to records must be within the maximum distance from the zip code. |
locationDataSource |
String |
This indicates where to get the data that matches the distance criteria. The valid options are B, C and S.
|
activeCustomerOnly |
String |
If you specify Y, then only customers and associated ship-to's whose sales last year or sales this year are greater than zero will be returned in the dataset. If you need a more finite way to control the returned records, use additional where parameter. |
getAttribute |
String |
Specify Y to retrieve the corresponding attributes for the customers and ship-to. This can be helpful if you have certain attribute information to return on the searching result. Do not indicate “Y” unless you need the data. Otherwise, performance can get slowed down unnecessarily. |
attributesWebFlag |
String |
If you specify Y to previous parameters, this specifies the criteria that the attribute must be a web attribute before being returned. |
getNotes |
String |
Similar to getAttribute, but for notes. This can be helpful if you have notes that describe your reseller to return on the search result. Do not indicate “Y” unless you need the data. Otherwise, performance can get slowed down unnecessarily. |
notesWebFlag |
String |
Similar to attributesWebFlag but for notes. |
getLinks |
String |
Specify “Y” to retrieve links. This can be helpful if your reseller has a website for you to return on the searching result. Do not indicate “Y” unless you need the data. Otherwise, performance can get slowed down unnecessarily. |
getEcontact |
String |
“Y” to retrieve eContacts. Do not indicate “Y” unless you need the data. Otherwise, performance can get slowed down unnecessarily. |
orderBy |
String |
This is the additional order by clause. Specify the customer or ship to dataset columns. If you wish to sort by distance, specify “DISTANCE.” |
additionalWhere |
String |
This is the additional where clause when retrieving data from customer table. Applicable if location data includes customer (e.g., B or C). For example, you may specify “CUS_TP = ‘GOLD’” to limit the return of customer that its customer type = ‘GOLD’ only. |
shipToAdditionalWhere |
String |
This is the additional where clause to apply when retrieve ship to table. Applicable if location source includes ship to (e.g., B or S) |
FindResellerResult Structure
Property |
Type |
Detail |
ReturnCode |
Integer |
Contains return code. Zero means OK; for other return codes, please see “EliloginService Return Code” section. |
AttributeTemplates |
Dataset |
|
Resellers |
DataSet |
Contains the following datasets: Customer, Attributes, EContacts, Links and Notes. For detail information of the dataset table, please refer to the following section. |
AttributeTemplates Structure
When getAttribute = “Y.” This table contains the same column heading as the SYATRFIL table. It will contain all attribute code records if the return dataset is set to getAttribute = “Y.”
Property |
Detail |
SYATRFIL_CODE |
|
SYATRFIL_DESC_1 |
|
SYATRFIL_DESC_2 |
|
SYATRFIL_REF_1_FLAG |
|
SYATRFIL_REF_1_LIT |
|
.. |
|
SYATRFIL_REF_5_FLAG |
|
SYATRFIL_REF_5_LIT |
|
SYATRFIL_DATE_1_FLAG |
|
SYATRFIL_DATE_2_LIT |
|
… |
|
SYATRFIL_AMT_1_FLAG |
|
SYATRFIL_AMT_1_LIT |
|
… |
|
Resellers Structure
Property |
Detail |
Customer |
Dataset with return records and columns in ARCUSFIL table |
ShipTo |
Dataset with return records and columns in CPSHPFIL table |
Attributes |
Dataset with return records and columns in SYATTRIB table |
EContact |
Dataset with return records and columns in SYCONREL and SYCONTCT tables |
Links |
Dataset with return records and columns in SYLNKFIL table |
Notes |
Dataset with return records and columns in NOTES table |
Code Example
The following sample code will return customers’ records within 20 miles distance from zip code 91789 with customer type equal to “GOLD.”
Dim Service As New webServicesReseller.ResellerFinder
Dim Result As New webServicesReseller.FindResellerResult
Result = Service.FindResller("", "", "91789", 20, "C", "", "", "", "", "", "", "", "DISTANCE", "CUS_TP = 'GOLD'", "")
If Result.ReturnCode = 0 Then
lblResult.Text = "Resellers Found"
Else
lblResult.Text = "Error! Error code: " + Result.ReturnCode.ToString
End If
ResellerFinder Return Code
0 = OK (No Error),
30000 = Database Error
30001 = No Record Found
30002 = General Error
CLS