Link to home
Start Free TrialLog in
Avatar of diecasthft01
diecasthft01

asked on

Specifying number of rows in a CFLOOP query

Good morning everyone...I have a question/problem which I hope is simple but I'm having a hard time coming up with a solution., I have a simple query, and that query will return several rows of information about a specific project. Each row has a specific id number. I can display the query results using CFLOOP and everything works fine. But what I want to do is a) only show three records (the last three entered) instead of every records and then b) have a button or link where the user can select to show the remaining records. My query is below:

<CFQUERY DATASOURCE="MCA_Oracle" NAME="GetExcludeCurDocCommentList">
 SELECT UNOB_REMARKS.*
 FROM MCA.UNOB_REMARKS
 WHERE UNOB_REMARKS.MIPR_ID = '#SESSION.urlpass.MIPR_ID#'
 ORDER BY UNOB_REMARKS.LAST_REMARK_UPDATE DESC
 </CFQUERY>

and then all I'm doing with the CFLOOP is:

<TABLE>


<CFLOOP query="GetExcludeCurDocCommentList">
<TR>
<TD><CFINPUT TYPE="Text"
                     NAME="Exs_DATE"
                     VALUE="#DateFormat(GetExcludeCurDocCommentList.LAST_REMARK_UPDATE,'mm/dd/yyyy')#"
                     SIZE="12"
                     MAXLENGTH="25"
                     style="border-color:WHITE; border-width:2; background-color:D1D0CE" readonly="Yes"></TD>

<TD><textarea rows="2" cols="73" name="Exs_Remark" style="border-color:WHITE; border-width:2; background-color:D1D0CE" readonly>#GetExcludeCurDocCommentList.REMARKS#</textarea></TD>

<TD><CFINPUT TYPE="Text"
                     NAME="Exs_ID"
                     VALUE="#GetExcludeCurDocCommentList.ID#"
                     SIZE="5"
                     MAXLENGTH="25"
                     style="border-color:WHITE; border-width:2; background-color:D1D0CE" readonly="Yes"></TD>
</tr></CFLOOP></TABLE>

Any help would be greatly appreciated!!!
ASKER CERTIFIED SOLUTION
Avatar of gdemaria
gdemaria
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of diecasthft01
diecasthft01

ASKER

That's perfect. That works exactly as I want it to. Thanks a lot!!!
Don't forget to wrap it in a val() to protect against sql injection , ie val(url.maxRows)