Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Loop over a delimited List and create an <cfoutput> as shown in the .Img

Posted on 2012-03-29
10
Medium Priority
?
224 Views
Last Modified: 2012-04-10
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
0
Comment
Question by:Dan Schimo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
10 Comments
 
LVL 39

Expert Comment

by:gdemaria
ID: 37783969
<cfloop index="aVal" list="#value#" delimiter=";">
   #aVal#<br>
</cfloop>
0
 

Author Comment

by:Dan Schimo
ID: 37784053
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


<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> 

Open in new window

0
 
LVL 39

Expert Comment

by:gdemaria
ID: 37784079
you're using "thisLink" inside your cfsavecontent before you're done creating it...


      <cfset result = result & trim(thisLink)>
   </cfsavecontent>
0
What is a Denial of Service (DoS)?

A DoS is a malicious attempt to prevent the normal operation of a computer system. You may frequently see the terms 'DDoS' (Distributed Denial of Service) and 'DoS' used interchangeably, but there are some subtle differences.

 
LVL 39

Expert Comment

by:gdemaria
ID: 37784096
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.Instrumentation#" index="thisTest" delimiters=";">
       <span class="rdLinkItem"><a href="">#thisTestI#</a></span><br>
       #thisTest#<br>
     </cfloop>
   </cfsavecontent>
  </cfoutput>
0
 

Author Comment

by:Dan Schimo
ID: 37784216
@gdemaria

Thanks for the catch , I put the cfset out side the cfsavecontent and now it is giving me the last record only,
0
 

Author Comment

by:Dan Schimo
ID: 37784605
i modified the code something like this which works ,and gives an output

output
 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>

Open in new window

0
 
LVL 39

Accepted Solution

by:
gdemaria earned 2000 total points
ID: 37785012
I'm not clear on what the output should be...  if no doi, then no link?

Maybe you can tweak this...

 <cfsavecontent variable="result">
        <cfoutput>
        <table >
            <cfloop list="#(arguments.record.instrumentation)#" index="aVal" delimiters=";">
                <tr>
                    <td>#aVal#</td>
					<td>
                    <cfif aVal contains "doi:">
                      <cfset theLink = listLast(aVal,":")>
                      <a href="#theLink#">#theLink#</a>
                    <cfelse>
                      &nbsp; <!--- no doi, so no link ---->
                    </cfif>
                   </td>					                    
                </tr>
            </cfloop>
        </table>
        </cfoutput>
    </cfsavecontent>

Open in new window

0
 

Author Comment

by:Dan Schimo
ID: 37785242
This works well , I am getting and out put looks like

op
However , I would like to remove the text marked inside the Yellow box ref fig.

I tried all the trim functions but they need a pos to start
0
 

Author Comment

by:Dan Schimo
ID: 37785705
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>&nbsp;</td>
           	  	</cfif>		                    
                </tr>
            </cfloop>
        </table>
        </cfoutput>     
    </cfsavecontent>
	

Open in new window

thanks gdemaria
0
 
LVL 39

Assisted Solution

by:gdemaria
gdemaria earned 2000 total points
ID: 37786888
looks good!   The only thing is that you can't declare "var" anywhere except the top of your function, so this line should thrown an error..

<cfset var PartDoi= aVal>

just remove the var from this line and declare the variable at the top of your function to empty:

<cfset var PartDoi= "">
0

Featured Post

AWS Certified Solutions Architect - Associate

This course has been developed to provide you with the requisite knowledge to not only pass the AWS CSA certification exam but also gain the hands-on experience required to become a qualified AWS Solutions architect working in a real-world environment.

Question has a verified solution.

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

Hi, Even though I have created this Tutorial on My personal Blog, Some people might not able to find my website, So here i am posting it again Today, from the topic it is very clear that i will be showing you here the very basic usage of how we …
CFGRID Custom Functionality Series -  Part 1 Hi Guys, I was once asked how it is possible to to add a hyperlink in the cfgrid and open the window to show the data. Now this is quite simple, I have to use the EXT JS library for this and I achiev…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

722 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