Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
gmahler5th #1
Rearranging records with code
I am working on a data driven application where I need to be able to rearrange
the ordering of records through a Web interface. (Perhaps similar to how you
rearrange movies in your queue at Netflix.com) There are about 200 records of
eLearning content, and I would like a courseware designer to be able to
rearrange what order the pages will be displayed by the Web application.
Does anyone have any CF techniques that will enable me to do this easily?
gmahler5th Guest
-
Why doesn't the Code Completion occur in FlexBuilder IDEwhen source code is in an external file?
I am seperating my .as from the MXML by using the following in my file.mxml: <mx:Script source="file.as"> When I edit file.as, the code... -
Table of Contents - Problem rearranging styles within TOC
Hmmm. This seems to have worked for the entire TOC except for one entry. No matter what I do, this one name puts itself on top of the title. If there... -
Rearranging XML fields before sending an xmlconnectorrequest?
Hello there!, could anyone help me with this question? I want to use my XMLConnector to send an XML chain to a servlet. the Schema for this... -
Rearranging controls
Hi, i am developing a user control that consists of different listboxes. The control needs the ability to arrange those listboxes in a different... -
Rearranging photos in Browser
One can rename and renumber photos in Browser. But how do you rearrange them in Browser BEFORE numbering so that they are in the sequence you desire? -
gmahler5th #2
Re: Rearranging records with code
For example, I see a record at position 100 and I want this record to be put at
position 90, and the previous record 90 to become 91, 91 to become 92, and so
on, rearranging the remainder of the records by one position.
I am thinking of some kind of loop, but not sure how to do the loop until the
end of a recordset.
gmahler5th Guest
-
NateNielsen #3
Re: Rearranging records with code
to answer your question on this specific issues, if you had records that were
ordered sequentially in the database in a column named order_number from 1-150,
and you wanted to move record 100 to record 40, rather than a loop you would do
something similar to this :
<<attaching code>>
-Nate Nielsen
[url]http://www.webclarity.com[/url]
<cfset currentOrderNumber = 100>
<cfset newOrderNumber = 40>
<cfquery datasource="yourDSN" name="qReorder">
-- set the record we want to move to the zero position
update sections set order_number = 0 where order_number =
#currentOrderNumber#;
-- set all records at [currentOrderNumber] or below to +1 the current value
update sections set order_number = order_number + 1 where order_number >=
#newOrderNumber#;
-- set the record we want to move into position
update sections set order_number = #newOrderNumber# where order_number = 0;
</cfquery>
NateNielsen Guest



Reply With Quote

