
|
|

Software Central: ASP - Classic | Useful ASP Functions for everybody | |
| If you know, Visual Basis, you must have used IIF function. You know how easy and great that function is.
If you do not know about IIF function, see the following example:
You need to send a value of 1 if customerType = 1 or you have to send 2.
Here is the normal code:
IF customerType = 1 THEN
sValue = 1
ELSE
sValue = 2
END IF
Instead of the above 5 lines, you can use the following single line, with IIF function.
sValue = IIF(customerType = 1, 1, 2)
But unfortunately, there is no similar function in ASP (VB Script).
But we can create that function, store it in a file and call that from any file as an include.
Here is the function:
FUNCTION IIF(valToCheck, trueAns, falseAns)
IF valToCheck THEN
IIF = trueAns
ELSE
IIF = falseAns
END IF
END FUNCTION
If anybody has any questions, pls. let me know. Looking forward to share useful functions with other members on TP.
Posted by: Mr Suresh KVS At: 15, Sep 2004 1:13:16 AM IST
|
|
|
 |
Advertisements |
|
 |
 |
Advertisements |
|