Solved

Help with VB script

Posted on 2013-10-31
2
295 Views
Last Modified: 2013-10-31
I have the following script which will conver the value of 0 or 1 to 'Yes' or 'No' so I can display it in the ASP page:

<SCRIPT RUNAT=SERVER LANGUAGE=VBSCRIPT>                                                            
function CI_ShowYesNo1(str)                        
on error resume next                        
if str then            
CI_ShowYesNo="Yes"            
else            
CI_ShowYesNo="No"            
end if            
End Function                                                                                    
</SCRIPT>      

display as:

<%= CI_ShowYesNo((Comments.Fields.Item("Visible").Value)) %>

I need to create a similar script called "CI_ShowStatus" that sould display

0 = open
1 = closed
2 = archived

then display the value on the ASP as:

<%= CI_ShowStatus((RsReportResults.Fields.Item("casestatus").Value)) %>
0
Comment
Question by:amucinobluedot
2 Comments
 
LVL 32

Accepted Solution

by:
Big Monty earned 500 total points
Comment Utility
relatively simple to do, try this:

function CI_ShowStatus(  statusID )
    select case CInt( statusID )
         case 0: CI_ShowStatus = "open"
         case 1: CI_ShowStatus = "closed"
         case 2: CI_ShowStatus = "archived"
    end select
end function

'-- to call it:
dim statusID   :    statusID = RsReportResults.Fields.Item("casestatus").Value
if statusID <> "" and isNumeric( statusID ) then
     someValue = CI_ShowStatus((RsReportResults.Fields.Item("casestatus").Value)) 
end if
Response.Write someValue

Open in new window

0
 

Author Closing Comment

by:amucinobluedot
Comment Utility
Sweet
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
Any business that wants to seriously grow needs to keep the needs and desires of an international audience of their websites in mind. Making a website friendly to international users isn’t prohibitively expensive and can provide an incredible return…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now