Solved

Help with VB script

Posted on 2013-10-31
2
303 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 500 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Learn by example how to specify CSS selectors for Selenium WebDriver test automation software.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
The viewer will learn how to count occurrences of each item in an array.

730 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