Dan Schimo
asked on
Loop over a delimited List and create an <cfoutput> as shown in the .Img
Hello experts,
I am need to Loop over a ; delimited List and create an <cfoutput> as shown in the .Img
Here is the List
Value ="Ketterer Stress Symptom Frequency Checklist; Symptom Checklist-90–Revised doi:10.1037/t01210-000 "
Please take a look at the img attached, need to create exact, also the numeric values in doi:10.1037/t01210-000 has to be a Hyper Link
DOI-test-and-measures.png
I am need to Loop over a ; delimited List and create an <cfoutput> as shown in the .Img
Here is the List
Value ="Ketterer Stress Symptom Frequency Checklist; Symptom Checklist-90–Revised doi:10.1037/t01210-000 "
Please take a look at the img attached, need to create exact, also the numeric values in doi:10.1037/t01210-000 has to be a Hyper Link
DOI-test-and-measures.png
ASKER
I am getting only the first record in the List
below is the Code I am using in the CFC, I am returning "thisLink" from the function.
also i need to put an href on the doi
below is the Code I am using in the CFC, I am returning "thisLink" from the function.
also i need to put an href on the doi
<cfloop list="#arguments.record.Instrumentation#" index="thisTest" delimiters=";">
<!---<cfset thisTestI = Trim(thisTest)>--->
<cfsavecontent variable="thisLink">
<cfoutput>
<!---<span class="rdLinkItem"><a href="">#thisTestI#</a></span><br>--->
#thisTest#<br>
</cfoutput>
<cfset result = result & trim(thisLink)>
</cfsavecontent>
</cfloop>
you're using "thisLink" inside your cfsavecontent before you're done creating it...
<cfset result = result & trim(thisLink)>
</cfsavecontent>
<cfset result = result & trim(thisLink)>
</cfsavecontent>
perhaps something like this... doesn't seem like you need the cfsavecontent just to create a variable that you then contact with another. Just build the entire thing inside the cfsavecontent
<cfoutput>
<cfsavecontent variable="result">
<cfloop list="#arguments.record.In strumentat ion#" index="thisTest" delimiters=";">
<span class="rdLinkItem"><a href="">#thisTestI#</a></s pan><br>
#thisTest#<br>
</cfloop>
</cfsavecontent>
</cfoutput>
<cfoutput>
<cfsavecontent variable="result">
<cfloop list="#arguments.record.In
<span class="rdLinkItem"><a href="">#thisTestI#</a></s
#thisTest#<br>
</cfloop>
</cfsavecontent>
</cfoutput>
ASKER
@gdemaria
Thanks for the catch , I put the cfset out side the cfsavecontent and now it is giving me the last record only,
Thanks for the catch , I put the cfset out side the cfsavecontent and now it is giving me the last record only,
ASKER
i modified the code something like this which works ,and gives an output
but separating the doi and putting an href around the numerical in doi:10.1037/t01210-000 is getting tough
but separating the doi and putting an href around the numerical in doi:10.1037/t01210-000 is getting tough
<cfsavecontent variable="result">
<cfoutput>
<table >
<cfloop list="#(arguments.record.instrumentation)#" index="i" delimiters=";">
<tr>
<td>#i#</td>
<td><cfset i = replaceNoCase(i, "doi*", "<span class=""correctedTerm"">hello</span>","all" ) >
<cfif len(i)><a href=>#i#</a></cfif></td>
</tr>
</cfloop>
</table>
</cfoutput>
</cfsavecontent>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
ASKER
I have modified the code to suffice all the reqs, please let me know if there is any unforseen errors
<cfsavecontent variable="result">
<cfoutput>
<table >
<cfloop list="#(arguments.record.instrumentation)#" index="aVal" delimiters=";">
<tr>
<cfif aVal contains "doi:">
<cfset var PartDoi= aVal>
<cfset thisLink = listLast(aVal,":")>
<cfset doi="doi:<a href=""#getLink(thisLink, baseURL)#"" target=""_blank"">#thisLink#</a>">
<cfset PartDoi = Rereplace(PartDoi, Rereplace(doi,'<[^>]*>','','all'),'', 'all' )>
<td>#PartDoi#</td>
<td>#doi#</td>
<cfelse>
<td>#aVal#</td>
<td> </td>
</cfif>
</tr>
</cfloop>
</table>
</cfoutput>
</cfsavecontent>
thanks gdemaria
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
#aVal#<br>
</cfloop>