|
You can format field values by adding ASP code.
Input value is stored in the variable strValue. Output value is
assigned to the same variable strValue. You can access other fields
of the same data record as rs("FieldName").
Examples:
1. Convert a string into the upper case.
ASP code:
strValue = Ucase(strValue)
|
2. Format 10-digit phone number into the following format (xxx)
xxx-xxx .
ASP code:
|
if
Len(strValue)=10
then
strValue = "("
&
Mid(strValue,1,3) & ")
" &
Mid(strValue,4,3) & "-"
&
Mid(strValue,7)
end
if
|
3. Display value of field FirstName as "<FirstName>
<LastName>" (if LastName field defined).
ASP code:
strValue = strValue & " " & rs("LastName")
|
4. Display a number in black color if number is positive and red
font if number is negative.
ASP code:
if CDbl(strValue)>0 then
color="black"
else
color="red"
end if
strValue= "<font color='" & color & "'>" & strValue & "</font>"
|
5. Display a field containing email address as email hyperlink
(mailto function used).
The value of subject in mailto function is set to a value of
another field.
ASP code:
strValue = "<a href='mailto:" & strValue & "?subject=" & rs("SubjectField") & "'>Send email</a>"
|
|