lshane
asked on
Classic ASP VBScript: How to separate comma-delimited listings into individual, dynamic links.
Classic ASP VBScript
MS Access
DWMX
WIN XP PRO
Hello. I have created a recordset and one of the fields has a list of comma-delimited values. How can I separate each of these value into individual links without creating another table for individual records?
The table is: [Team Members]
The field is: {tm_mentee}
The tm_mentee values would look like: (202800, 202810, 202820), etc.
Each of these numbers represents a Team Member.
I would like to make them individual links, if that's possible. Obviously when I just link the initial dynamic content, it lists all of the numbers, but makes all of them one, big link.
Thanks so much,
Shane
MS Access
DWMX
WIN XP PRO
Hello. I have created a recordset and one of the fields has a list of comma-delimited values. How can I separate each of these value into individual links without creating another table for individual records?
The table is: [Team Members]
The field is: {tm_mentee}
The tm_mentee values would look like: (202800, 202810, 202820), etc.
Each of these numbers represents a Team Member.
I would like to make them individual links, if that's possible. Obviously when I just link the initial dynamic content, it lists all of the numbers, but makes all of them one, big link.
Thanks so much,
Shane
ASKER
Hello, basicinstinct. Thank you for replying. I viewed that section from your link, but I'm a little unsure how to implement that with my field. Here's my recordset:
========================== ========== ========== ========== ========== ========== =
<%
Dim rsMenteeList
Dim rsMenteeList_numRows
Set rsMenteeList = Server.CreateObject("ADODB .Recordset ")
rsMenteeList.ActiveConnect ion = MM_connPMDData2_DSN_STRING
rsMenteeList.Source = "SELECT * FROM team_members WHERE tm_ID = " + Replace(rsMenteeList__MMCo lParam, "'", "''") + ""
rsMenteeList.CursorType = 0
rsMenteeList.CursorLocatio n = 2
rsMenteeList.LockType = 1
rsMenteeList.Open()
rsMenteeList_numRows = 0
%>
========================== ========== ========== ========== ========== ========== =
There is a MEMO field in that table called "tm_mentee", and it contains a comma-delimited list, such as the one I posted above.
On the page where the dynamic content is viewed, I type: "<a href="#"><%=(rsMenteeList. Fields.Ite m("tm_ment ee").Value )%></a>".
There's not a loop anywhere. I just want to split out the list in that MEMO field and make them individual links.
Any ideas?
Thanks so much,
Shane
==========================
<%
Dim rsMenteeList
Dim rsMenteeList_numRows
Set rsMenteeList = Server.CreateObject("ADODB
rsMenteeList.ActiveConnect
rsMenteeList.Source = "SELECT * FROM team_members WHERE tm_ID = " + Replace(rsMenteeList__MMCo
rsMenteeList.CursorType = 0
rsMenteeList.CursorLocatio
rsMenteeList.LockType = 1
rsMenteeList.Open()
rsMenteeList_numRows = 0
%>
==========================
There is a MEMO field in that table called "tm_mentee", and it contains a comma-delimited list, such as the one I posted above.
On the page where the dynamic content is viewed, I type: "<a href="#"><%=(rsMenteeList.
There's not a loop anywhere. I just want to split out the list in that MEMO field and make them individual links.
Any ideas?
Thanks so much,
Shane
strLinks = split(rsMenteeList.Fields. Item("tm_m entee").Va lue)
for i = 0 to ubound(strLinks)
response.write("<a href=""#"">" & strLinks(i) & "</a>")
next
for i = 0 to ubound(strLinks)
response.write("<a href=""#"">" & strLinks(i) & "</a>")
next
ASKER
Hello, kevp75. Where would I place this section of code?
Thanks so much,
Shane
Thanks so much,
Shane
replace your existing code:
"<a href="#"><%=(rsMenteeList. Fields.Ite m("tm_ment ee").Value )%></a>".
with kevs function
"<a href="#"><%=(rsMenteeList.
with kevs function
but it should be this:
dim strLinks
strLinks = split(rsMenteeList.Fields. Item("tm_m entee").Va lue, ",")
for i = 0 to ubound(strLinks)
response.write("<a href=""#"">" & strLinks(i) & "</a>")
next
dim strLinks
strLinks = split(rsMenteeList.Fields.
for i = 0 to ubound(strLinks)
response.write("<a href=""#"">" & strLinks(i) & "</a>")
next
aye....forgot the character to split on....
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ok, thank you, but still getting probs.
I replaced my code with the function in this way:
========================== ========== ========== ========== ======
<%dim strLinks
strLinks = split(rsMenteeList.Fields. Item("tm_m entee").Va lue, ",")
for i = 0 to ubound(strLinks)
response.write("<a href=""#"">" & trim(strLinks(i)) & "</a>")
next%>
========================== ========== ========== ========== ======
... but my result was:
202802202804202811
Pretty much what I had.
Am I doing something wrong?
Thanks,
Shane
I replaced my code with the function in this way:
==========================
<%dim strLinks
strLinks = split(rsMenteeList.Fields.
for i = 0 to ubound(strLinks)
response.write("<a href=""#"">" & trim(strLinks(i)) & "</a>")
next%>
==========================
... but my result was:
202802202804202811
Pretty much what I had.
Am I doing something wrong?
Thanks,
Shane
ASKER
Did my last posting come through?
well just to confirm, when you do this:
<%=(rsMenteeList.Fields.It em("tm_men tee").Valu e)%>
you get a comma separated list of values right? can you post the output of that here?
<%=(rsMenteeList.Fields.It
you get a comma separated list of values right? can you post the output of that here?
do this:
<%dim strLinks
strLinks = split(rsMenteeList.Fields. Item("tm_m entee").Va lue, ",")
for i = 0 to ubound(strLinks)
response.write("<a href=""#"">" & trim(strLinks(i)) & "</a><br />")
next%>
<%dim strLinks
strLinks = split(rsMenteeList.Fields.
for i = 0 to ubound(strLinks)
response.write("<a href=""#"">" & trim(strLinks(i)) & "</a><br />")
next%>
ASKER
Hey, kevp75. That did it! Here's the result:
202802
202804
202811
I do have one other piggy-back question for this, but if I need to re-thread, I will.
What I REALLY need to do is send the value of each of those value in a string:
<some_process_page.asp?Men teeNumber= ...>
They are links, but hw can I get each of those to send their own value?
Thanks SO much,
Shane
202802
202804
202811
I do have one other piggy-back question for this, but if I need to re-thread, I will.
What I REALLY need to do is send the value of each of those value in a string:
<some_process_page.asp?Men
They are links, but hw can I get each of those to send their own value?
Thanks SO much,
Shane
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you both for your input. I awarded kevp75 more points for the solution.
Thank you, basicinstinct, for jumping in and catching the details.
Thanks so much,
Shane
P.S. I may be back with another question related to this, as I would really like to show the Employee names that match these values, but I will see if I can get it to work over here.
Thank you, basicinstinct, for jumping in and catching the details.
Thanks so much,
Shane
P.S. I may be back with another question related to this, as I would really like to show the Employee names that match these values, but I will see if I can get it to work over here.
thanks for the grade :)
http://www.w3schools.com/vbscript/func_split.asp