Conditional Hyperlink in FP2000

B

Brooks Clayton

I have an asp page on my website pulling from an MS database. On this
page, among other data, is a FedEx tracking number. This tracking
number is a hyperlink and uses the following code:
http://www.fedex.com/cgi-bin/tracking?template_type=plugin&tracknumbers=<%=FP_FieldURL(fp_rs,"TrackingNo")%>&action=track&language=english&cntry_code=us

It works well, taking the viewer to the FedEx results page for that
number. The problem now is that we are also using Airborne and would
like for user to automatically be taken to Airborne's page for the
results, if it is an Airborne number. FedEx and Airborne use a
different number of characters in their tracking numbers.

Question: Can I use a conditional hyperlink based upon the lenth of
the tracking number? Like an IF statement? Any help or code
appreciated. (I have the code from Airborne for their site) Thanks

Brooks
 
K

Kevin Spencer

Sure you can. An ASP application generates dynamic HTML, so it can certainly
generate something as simple as a hyperlink. Here's an example:

<%
Dim strURL
If SomeVariableIdentifyingWhichVendor = "Airborne" Then
strURL = "http://Airborne.com"
Else
strURL =
"http://www.fedex.com/cgi-bin/tracking?template_type=plugin&tracknumbers=<%=
FP_FieldURL(fp_rs,"TrackingNo")%>&action=track&language=english&cntry_code=u
s"
End If
%>

<a href="<%=strURL%>">Click Here to go Somewhere</a>

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
B

Brooks Clayton

Kevin,

Your reply was most helpful; thank you.

I have created the code below based upon your suggestion and the code
that I was using for FedEx. However, there are somethings wrong with
it; I suspect in the syntax. I have struggled with it, but have not
gotten it to work. Any suggestions?

<%
Dim strURL
If Len(<%=FP_FieldURL(fp_rs,"TrackingNo")%> = 11 Then
strURL=
"http://track.airborne.com/TrackByNbr.asp?ShipmentNumber="&<%=FP_FieldURL(fp_rs,"TrackingNo")%>
Else
strURL
="http://www.fedex.com/cgi-bin/tracking?template_type=plugin&tracknumbers=<%=FP_FieldURL(fp_rs,"TrackingNo")%>&action=track&language=english&cntry_code=us"
End If
%>

Thanks,

Brooks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top