Quantcast
Channel: Adobe Community : Unanswered Discussions - ColdFusion Application Development (read only)
Viewing all articles
Browse latest Browse all 70

Array, List, or Recordset

$
0
0

Not sure how to label this issue that I am trying to solve...

 

What I am trying to do is take a list of students from a database query recordset and assign them the a counselor from a database query recordset and place them in an alternating rotation Monday through Friday for the remainder of the year.

 

Example of desired result.

 

 

student1 - June 6,   2011Counselor1
student1 - June 7, 2011Counselor2
student1 - June 8, 2011Counselor3
student1 - June 9, 2011Counselor4
student1 - June 10, 2011Counselor5
student1 - June 11, 2011Counselor6
student1 - June 12, 2011Counselor7
student1 - June 13, 2011Counselor8
student1 - June 14, 2011Counselor9
student1 - June 15, 2011Counselor10
student1 - June 16, 2011Counselor11
student1 - June 17, 2011Counselor12
student1 - June 18, 2011Counselor1
student1 - June 19, 2011Counselor2
student1 - June 20, 2011Counselor3
student1 - June 21, 2011Counselor4
student1 - June 22, 2011Counselor5
student1 - June 23, 2011Counselor6
student1 - June 24, 2011Counselor7
student1 - June 25, 2011Counselor8
student1 - June 26, 2011Counselor9
student1 - June 27, 2011Counselor10
student1 - June 28, 2011Counselor11
student1 - June 29, 2011Counselor12
student1 - June 30, 2011Counselor1
student2 - June 6, 2011Counselor2
student2 - June 7, 2011Counselor3
student2 - June 8, 2011Counselor4
student2 - June 9, 2011Counselor5
student2 - June 10, 2011Counselor6
student2 - June 11, 2011Counselor7
student2 - June 12, 2011Counselor8
student2 - June 13, 2011Counselor9
student2 - June 14, 2011Counselor10
student2 - June 15, 2011Counselor11
student2 - June 16, 2011Counselor12
student2 - June 17, 2011Counselor1
student2 - June 18, 2011Counselor2
student2 - June 19, 2011Counselor3
student2 - June 20, 2011Counselor4
student2 - June 21, 2011Counselor5
student2 - June 22, 2011Counselor6
student2 - June 23, 2011Counselor7
student2 - June 24, 2011Counselor8
student2 - June 25, 2011Counselor9
student2 - June 26, 2011Counselor10
student2 - June 27, 2011Counselor11
student2 - June 28, 2011Counselor12
student2 - June 29, 2011Counselor1
student2 - June 30, 2011Counselor2
student3 - June 6, 2011Counselor3
student3 - June 7, 2011Counselor4
student3 - June 8, 2011Counselor5
student3 - June 9, 2011Counselor6
student3 - June 10, 2011Counselor7
student3 - June 11, 2011Counselor8
student3 - June 12, 2011Counselor9
student3 - June 13, 2011Counselor10
student3 - June 14, 2011Counselor11
student3 - June 15, 2011Counselor12
student3 - June 16, 2011Counselor1
student3 - June 17, 2011Counselor2
student3 - June 18, 2011Counselor3
student3 - June 19, 2011Counselor4
student3 - June 20, 2011Counselor5
student3 - June 21, 2011Counselor6
student3 - June 22, 2011Counselor7
student3 - June 23, 2011Counselor8
student3 - June 24, 2011Counselor9
student3 - June 25, 2011Counselor10
student3 - June 26, 2011Counselor11
student3 - June 27, 2011Counselor12
student3 - June 28, 2011Counselor1
student3 - June 29, 2011Counselor2
student3 - June 30, 2011Counselor3

 

I have tried a combination of lists, nested index loops, and mutli dimensional arrays. I have seemed to be dead locked. This is a start to the example of what I have been trying and I am sure you can see it isn't the desired result. It will provide only a student schedule without an assigned counselor. The problem has been fitting the counselor into the rotation.

 

 

<cfset daysleft = DaysinYear(todaysDate) - DayofYear(todaysDate) >

 

<cfoutput query="StudentQuery">
    <cfloop index = "LoopCount" from = "0" to = "#daysleft#">
        <cfset scheduledate = DayOfWeek(todaysdate+Loopcount)>
            <cfif DayOfWeek(scheduledate) is not 7 AND DayOfWeek(scheduledate) is not 1>
                #StudentName# - #DayofWeekAsString(DayOfWeek(scheduledate))# - #DateFormat((todaysdate+Loopcount), 'long')#<br>
            </cfif>
    </cfloop><br />
</cfoutput>

 

Keep in mind there needs to be an finite number of students and counselors determined by database records that do change. The plan is to rerun the script weekly as these records change. The dates are finite and simply reduce from week to week. December 31st is the last day. Any help is appreciated.


Viewing all articles
Browse latest Browse all 70

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>