Solved

Help with VB script

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Read about why website design really matters in today's demanding market.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn how to count occurrences of each item in an array.
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

919 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

24 Experts available now in Live!

Get 1:1 Help Now