Skip to main content

Posts

Showing posts with the label cfloop

ColdFusion - How to loop over a time range

cfloop - loop over a time range cflooptime.cfm <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>cfloop tag example: how to loop over a time range in coldfusion</title> </head> <body> <h2 style="color:Crimson">cfloop Tag Example: time range</h2> <cfset LoopStartTime=CreateTime(0,0,0)> <cfset LoopEndTime=CreateTime(5,0,0)> <cfoutput> <b>LoopStartTime:</b> #LoopStartTime#<br /> <b>LoopEndTime:</b> #LoopEndTime#<br /> </cfoutput> <br /><br /> Loop start[step 30 minutes] ...<br /> <cfloop from="#LoopStartTime#" to="#LoopEndTime#" index="i" step="#CreateTimeSpan(0,0,30,0)#"> <cfoutput> <b>Current Position:</b> #TimeFormat(i)#<br /> ...

How to loop over a query in ColdFusion

cfloop - loop over a query cfloopquery.cfm <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>cfloop tag example: how to loop over a query in coldfusion</title> </head> <body> <h2 style="color:Crimson">cfloop Tag Example: Query</h2> <cfquery name="qEmployees" datasource="cfdocexamples"> SELECT Emp_ID, FirstName, LastName FROM EMPLOYEES </cfquery> <cfoutput> <table cellpadding="0" cellspacing="0" style="color:White" border="1"> <tr bgcolor="HotPink"> <td><b>Emp_ID</b></td> <td><b>FirstName</b></td> <td><b>LastName</b></td> </tr> <cfloop query=...

How to loop over a list in ColdFusion

cfloop - loop over a list cflooplist.cfm <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>cfloop tag example: how to loop over a list in coldfusion</title> </head> <body> <h2 style="color:Crimson">cfloop Tag Example: List</h2> <cfloop list="Jenny,Jones,John,Ben,Raymond,Kak" index="ListElement" delimiters=","> <cfoutput> <b>Current List Element:</b> #ListElement#<br /> </cfoutput> </cfloop> <br /><br /> <cfset CityList="Rome;London;NewYork"> <cfoutput> <b>CityList:</b> #CityList#<br /> </cfoutput> <cfloop list="#CityList#" index="ListElement" delimiters=";"> <cfoutput> <b>Current List Element:</b>...

How to perform index loop in ColdFusion

cfloop - index loop cfloopindex.cfm <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>cfloop tag example: how to use index loop in coldfusion</title> </head> <body> <h2 style="color:Crimson">cfloop Tag Example: index</h2> <cfoutput> <b>Loop start[1 to 10]....</b><br /> <cfloop from="1" to="10" index="Counter"> Current position: #Counter#<br /> </cfloop> <b>Loop End....</b><br /> <br /><br /> <b>Loop start[1 to 10; step 2]....</b><br /> <cfloop from="1" to="10" step="2" index="Counter"> Current position: #Counter#<br /> </cfloop> <b>Loop End....</b...

How to loop over a date range in ColdFusion

cfloop - loop over a date range cfloopdate.cfm <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>cfloop tag example: how to loop over a date range in coldfusion</title> </head> <body> <h2 style="color:Crimson">cfloop Tag Example: date range</h2> <cfset LoopStartDate="5-Dec-2008"> <cfset LoopEndDate="12-Dec-2008"> <cfoutput> <b>LoopStartDate:</b> #LoopStartDate#<br /> <b>LoopEndDate:</b> #LoopEndDate#<br /> </cfoutput> <br /><br /> Loop start ...<br /> <cfloop from="#LoopStartDate#" to="#LoopEndDate#" index="i"> <cfoutput> <b>Current Position:</b> #DateFormat(i)#<br /> </cfoutput> </cfloop> <br />...

How to perform conditional loop in ColdFusion

cfloop - conditional loop cfloopconditional.cfm <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>cfloop tag example: how to use conditional loop in coldfusion</title> </head> <body> <h2 style="color:Crimson">cfloop Tag Example: conditional</h2> <cfset LoopEndPosition=5> <cfoutput> <b>Loop End Position:</b> #LoopEndPosition# </cfoutput> <br /><br /> <cfset Counter=0> Loop Start...<br /> <cfloop condition="LoopEndPosition GT Counter"> <cfset Counter=Counter+1> <cfoutput> <b>Current Position:</b> #Counter#<br /> </cfoutput> </cfloop> Loop End... </body> </html> More ColdFusion examples cfquery - update data cfloop - index loop cffunction ...

How to loop over an array in ColdFusion

cfloop - loop over an array cflooparray.cfm <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>cfloop tag example: how to loop over an array in coldfusion</title> </head> <body> <h2 style="color:Crimson">cfloop Tag Example: Array</h2> <cfset ColorArray=ArrayNew(1)> <cfset ColorArray[1]="Red"> <cfset ColorArray[2]="Green"> <cfset ColorArray[3]="Yellow"> <cfset ColorArray[4]="Blue"> <cfdump var="#ColorArray#" label="ColorArray"> <br /> Loop Start[ColorArray]...<br /> <cfloop array="#ColorArray#" Index="Color"> <cfoutput> <b>Current Color:</b> #Color#<br /> </cfoutput> </cfloop> </body> </html> More Col...