portal entry

select a category, or use search below
(searches all categories and all time range)

how can ? make a total number the end of list?

| View in Portal
February 09, 2020 05:49:44 PM GMT
<p>? must make a  salary list and the end of page(under of the list number) ? w?ll show the number.like a excell. how can ? write with coldfus?on?help please. for exp: 1 =10 2=20 30</p>
<p>The post <a rel="nofollow" href="https://coldfusion.adobe.com/2020/02/can-make-total-number-end-list/">how can ? make a total number the end of list?</a> appeared first on <a rel="nofollow" href="https://coldfusion.adobe.com">ColdFusion</a>.</p>
Labels: Blog, ColdFusion, Modern CFML, Question, modern cfml, question


<blockquote><cfset salaryList="10, 20,30,40,60"> <cfoutput> <cfloop index="i" from="1" to="#listLen(salaryList)#" > #i# : #listGetAt(salaryList,i,",")# <br> </cfloop> </cfoutput></blockquote>
Comment by BKBK
3650 | February 11, 2020 03:29:28 PM GMT
<cfset salaryList = "10,20,30,40,60"> <cfoutput> <cfloop from="1" to="#listLen(salaryList, ',')#" index="i"> #i# : #listGetAt(salaryList, i, ',')# <br> </cfloop> </cfoutput>
Comment by BKBK
3649 | February 11, 2020 03:40:49 PM GMT
There are many ways, but perhaps the easiest solution may be to simply convert the list to an array, and then use the CF arraysum function. That could be done in one line (using BKBK's shown salarylist list): <pre>arraysum(listtoarray(salarylist));</pre> I can't tell, nurcanb, if you meant to be showing us code in your first example. It looks like maybe you put in CFML and it was lost. You may want to use the "preformatted" option in the drop-down for style while typing here. Let us know if that code fragment I shared above helps.
Comment by Charlie Arehart
3652 | February 11, 2020 06:01:33 PM GMT
thank u for u helping.? can solve it:)
Comment by nurcanb61753314
4653 | February 12, 2020 11:50:33 AM GMT
Good to hear. Can you mark whichever reply you may feel was the answer? That can help future readers.
Comment by Charlie Arehart
4651 | February 12, 2020 11:35:03 PM GMT