ASP HTML

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
tmurray22Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ryan ChongCommented:
Can you post your ASP scripts here, we will try to figure it out for you here...
0
bubbledragonCommented:
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
tmurray22Author Commented:
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
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

Ryan ChongCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
tmurray22Author Commented:
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
Ryan ChongCommented:
>>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
tmurray22Author Commented:
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
jessegivyDeveloperCommented:
Use a table, or divs
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.