?
Solved

ASP HTML

Posted on 2006-03-28
8
Medium Priority
?
264 Views
Last Modified: 2010-04-06
I have Data like the following. I need to display it a little nicer.
I would like to sort the data by the string before the under score then add a heading like:

example
current data

[]    123_ABC_01
[]    123_ABC_02
[]    123_ABC_03
[]    XYZ_ZZZ_01
[]    XYZ_ZZZ_02
[]    XYZ_ZZZ_04
[]    PTP_YYY_01
[]    PTP_YYY_02

would then display like

         123
[]    123_ABC_01
[]    123_ABC_02
[]    123_ABC_03
 
         XYZ
[]    XYZ_ZZZ_01
[]    XYZ_ZZZ_02
[]    XYZ_ZZZ_04

          PTP
[]    PTP_YYY_01
[]    PTP_YYY_02
0
Comment
Question by:tmurray22
8 Comments
 
LVL 54

Expert Comment

by:Ryan Chong
ID: 16318817
Can you post your ASP scripts here, we will try to figure it out for you here...
0
 
LVL 7

Expert Comment

by:bubbledragon
ID: 16319563
Dim strCaption as String
Dim i as integer
Dim a As Variant

strCaption = ""
For i = 0 To (ubound(a) - 1) Step 1
    If StrCaption <> Mid( a(i), 1, InStr(1, a(i), "_", vbTextCompare) - 1) Then
        Response.write Mid( a(i), 1, InStr(1, a(i), "_", vbTextCompare) - 1)+"<BR>"
        Response.write a(i)+"<BR>"
    Else
        Response.write a(i)+"<BR>"
    End If

    StrCaption = Mid( a(i), 1, InStr(1, a(i), "_", vbTextCompare) - 1)
Next
0
 

Author Comment

by:tmurray22
ID: 16324002
Does tht code go into the sub? here is my code

sub makeCity()
     if strOS <> "Select a Release First" AND  strOS <> "Select OS Now" AND strOS <>"" then
          if not isObject("objRS") then
               set objRS=Server.CreateObject("ADODB.RecordSet")
          end if
          if objRS.state <> 0 then
               objRS.close
          end if
          'objRS.Open "SELECT DISTINCT multisub FROM cmpmap WHERE codeline = '" & strOS & "' ORDER BY multisub",objConnection,3,3
          objRS.Open "Select DISTINCT bldlabel from cmpsub join cmpmap on cmpmap.multisub = cmpsub.cmpname and cmpmap.subcode = cmpsub.codeline where cmpmap.codeline =  '" & strOS & "'" ,objConnection,3,3
          'objRS.Open "Select DISTINCT bldlabel from cmpsub join cmpmap on cmpmap.multisub = cmpsub.cmpname where cmpmap.codeline =  '" & strOS & "'" ,objConnection,3,3
              if objRS.eof then
             '  Response.Write("<option>No Builds Found</option>")
                Response.Write("<p>No Builds Found</p>")
          else
             'Response.Write("<p>Select Build Now</p>" & VBCRLF )
%>
<div align="center">
  <table border="1" width="18%" id="table1">
  <tr>
    <td width="97">
<%
               do while not objRS.EOF
                    if objRS("BldLabel") = strBuild then
                         strSelected = " Checked "
                    else
                         strSelected = ""
                    end if
%>
<tr><td><input type=checkbox name=BldLabel <%=strSelected%> value="<%=objRS("BldLabel")%>"></td>
<td><%=objRS("BldLabel")%></td>
</tr>
<%
                    objRS.MoveNext
               loop
          end if%>
          </table>
</div>
<%
          objRS.Close
          set objRS=Nothing
     else
          'Response.Write("<p>Select an OS First</p>")
     end if
end sub

%>
0
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!

 
LVL 54

Accepted Solution

by:
Ryan Chong earned 2000 total points
ID: 16324067
try this:

sub makeCity()
     if strOS <> "Select a Release First" AND  strOS <> "Select OS Now" AND strOS <>"" then
          if not isObject("objRS") then
               set objRS=Server.CreateObject("ADODB.RecordSet")
          end if
          if objRS.state <> 0 then
               objRS.close
          end if
          'objRS.Open "SELECT DISTINCT multisub FROM cmpmap WHERE codeline = '" & strOS & "' ORDER BY multisub",objConnection,3,3
          objRS.Open "Select DISTINCT bldlabel from cmpsub join cmpmap on cmpmap.multisub = cmpsub.cmpname and cmpmap.subcode = cmpsub.codeline where cmpmap.codeline =  '" & strOS & "'" ,objConnection,3,3
          'objRS.Open "Select DISTINCT bldlabel from cmpsub join cmpmap on cmpmap.multisub = cmpsub.cmpname where cmpmap.codeline =  '" & strOS & "'" ,objConnection,3,3
              if objRS.eof then
             '  Response.Write("<option>No Builds Found</option>")
                Response.Write("<p>No Builds Found</p>")
          else
             'Response.Write("<p>Select Build Now</p>" & VBCRLF )
%>
<div align="center">
  <table border="1" width="18%" id="table1">
  <tr>
    <td width="97">
<%
                   tmp = ""
               do while not objRS.EOF
                    if objRS("BldLabel") = strBuild then
                         strSelected = " Checked "
                    else
                         strSelected = ""
                    end if
                              
                              if left("" & objRS("BldLabel"), 3) <> tmp then
                                    tmp = left("" & objRS("BldLabel"), 3)
                              %>
                              <tr><td><%=tmp%></td>
                              <%                                    
                              end if
                              
%>
<tr><td><input type=checkbox name=BldLabel <%=strSelected%> value="<%=objRS("BldLabel")%>"></td>
<td><%=objRS("BldLabel")%></td>
</tr>
<%
                    objRS.MoveNext
               loop
          end if%>
          </table>
</div>
<%
          objRS.Close
          set objRS=Nothing
     else
          'Response.Write("<p>Select an OS First</p>")
     end if
end sub

%>
0
 

Author Comment

by:tmurray22
ID: 16324618
Very close, but I dont think my data represented all the scenarios. It is really everything
to the left of the _ (underscore)

so while it works for
[]    123_ABC_02
[]    123_ABC_03
[]    XYZ_ZZZ_01
[]    XYZ_ZZZ_02

it doesnt pick up correctly

[]    1243_ABC_02 or
[]    GGHTF_123_ZZ  ect.

Also is there a away to start a new column if the data goes over 20 values?
0
 
LVL 54

Expert Comment

by:Ryan Chong
ID: 16324894
>>Also is there a away to start a new column if the data goes over 20 values?
I not quite understand this, can you explain this more clearly?
0
 

Author Comment

by:tmurray22
ID: 16325315
If I have say 50 checkboxes that are created. It lists them vertically so a user must do a lot of scrolling

so for example not this:

[]    123_ABC_01
[]    123_ABC_02
[]    123_ABC_03
[]    XYZX_ZZZ_01
[]    XYZX_ZZZ_02
[]    XYZX_ZZZ_04
[]    PTPR5_YYY_01
[]    PTPR5_YYY_02

but this

123                       XYZX
[]    123_ABC_01    []    XYZX_ZZZ_01
[]    123_ABC_02    []    XYZX_ZZZ_02
[]    123_ABC_03    []    XYZX_ZZZ_04

PTPR5
[]    PTPR5_YYY_01
[]    PTPR5_YYY_02

0
 
LVL 12

Expert Comment

by:jessegivy
ID: 16337944
Use a table, or divs
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

839 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