-1

I have a query that retrieves an ID, comments, and status column from my table. Both the comments and status can be updated by the user on the page. The ID is used to update each record. I have set it up so that a loop will occur based on the query RecordCount but the counter returns the value multiply times:

i.e. RowCount = 3, 3, 3

If I manually update my syntax to show the the loop counter as 3, it works fine. I am using the cfoutput tag to output to an HTML table so, the tag is located within the table. Would this matter? Anyways, here is my syntax for setting the record count:

<form action="cit_update.cfm" method="post" id="citUpdate">
<input type="hidden" name="RowCount" value="#ReviewExpand.RecordCount#">
PPJN
  • 332
  • 3
  • 13
  • Your question is not quite clear but those can be 2 things. 1. RecordCount return always number of returned rows from query so if your query return 3 rows it will return 3. 2. if it's inserted in one place many times like 3 3 3 you have somewhere inside . YOu need to change to and everything will be fine – Bonanza Mar 24 '16 at 19:54
  • Bonanza, Thanks for the quick reply. I think I just figured it out. I've been stumped for some time!In my loop, I simply added #val(RowCount)# instead of just #RowCount# and it worked fine. When I substituted cfoutput for cfloop, my page didn't load anything. – PPJN Mar 24 '16 at 19:59
  • Still can't seem to find why my input field returns a comma delimited list of the recordcount... The val() solution works but isn't ideal – PPJN Mar 24 '16 at 20:17
  • But recordcount returns always integer. Never list of values. If you want list of your ids you need to loop over your query to generate that list – Bonanza Mar 24 '16 at 20:23
  • For whatever reason, mine keeps returning the value as a comma delimited list i.e. if two rows are returns from the query, RowCount = 2, 2. Would this have anything to do with the form being enclosed within a cfoutput tag? – PPJN Mar 24 '16 at 20:40
  • Because you have inside . Before opening with query close for page content. Like that: page content form rest of the site – Bonanza Mar 24 '16 at 20:42
  • 3
    If you are new to Stack Overflow, it is best to post the CF code, rather than *describing* it. Only the relevant parts - ie CF code. Omit any unrelated stuff like html/css/javascript. See [How to create a Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve). – Leigh Mar 24 '16 at 21:25
  • Sounds like you have two or more formfields called 'rowcount'. When you have a form with two or more fields with the same name and submit it, ColdFusion will combine the values into a comma delimited list. Is your hidden `RowCount` formfield inside a loop? – John Whish Mar 30 '16 at 11:42

1 Answers1

1

You are using #ReviewExpand.RecordCount# inside a <cfoutput query="ReviewExpand"> TAG, then your return is occurring RecourdCount times.

You need get the recordCount out of the <cfoutput query="">... loop.

Paulo Teixeira
  • 448
  • 5
  • 11