?
Solved

Help with VB script

Posted on 2013-10-31
2
Medium Priority
?
305 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 33

Accepted Solution

by:
Big Monty earned 2000 total points
ID: 39614159
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
ID: 39614167
Sweet
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Color can increase conversions, create feelings of warmth or even incite people to get behind a cause. If you want your website to really impact site visitors, then it is vital to consider the impact color has on them.
Originally, this post was published on Monitis Blog, you can check it here . It goes without saying that technology has transformed society and the very nature of how we live, work, and communicate in ways that would’ve been incomprehensible 5 ye…
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.
Suggested Courses

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