Solved

Help with VB script

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
rebind a grid after user clicks on node in treeview 1 35
Help with query 3 25
Creating An Intelligent Dropdown 8 28
Hide cell in a table 2 12
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 walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

770 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