Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tidy up code please

Status
Not open for further replies.

weblead

Technical User
Sep 18, 2003
32
AT
Hi guys,

I have line of text on my asp page that changes depending on the querystring. I have it working using the code below, but I am sure it is primitive like my coding skills. Can someone show me the cool way to write this please?

<% if groups = &quot;p1&quot; Then
response.write&quot;Participating countries&quot;
end if %>
<% if groups = &quot;p2&quot; Then
response.write&quot;Work between first and second RCM&quot;
end if %>
<% if groups = &quot;p3&quot; Then
response.write&quot;Work between second and third RCM&quot;
end if %>
<% if groups = &quot;p4&quot; Then
response.write&quot;Procedures&quot;
end if %>
<% if groups = &quot;p5&quot; Then
response.write&quot;Data, results and progress reports,&quot;
end if %>
<% if groups = &quot;p6&quot; Then
response.write&quot;Central evaluation of results&quot;
end if %>
<% if groups = &quot;p7&quot; Then
response.write&quot;Bibliographic references&quot;
end if %>
<% if groups = &quot;p8&quot; Then
response.write&quot;Papers originated&quot;
end if %>
<% if groups = &quot;p9&quot; Then
response.write&quot;Draft TECDOC of the CRP&quot;
end if %>

'groups' is of course a variable.
 
Code:
select case groups
 case &quot;p1&quot;:
	output = &quot;Participating countries&quot;
 case &quot;p2&quot;:
	output = &quot;Work between first and second RCM&quot;
 'contnue on for other cases
end select

response.write output
Should be a little less code.
 
Hey thanks LV!

Will make me look like I know what I am doing ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top