I have made some pages that display in columns and are updatable. There are
actually over 50 entries they can make which are split between several
pages. To update just the page the user is editing I have hardcoded the
point on the list that should be updated. Well if all
stayed exactly the same this would be fine. However, I need to make this
more robust.
1. I will be having 4 different user groups that will need to update only
their information. Each group has a different amount of entries to
update. So for each group I currently would have to do a separate set of
hardcoded if/else statements.
2. It is set up that if there is a change in one section it throws all my
index(skilloffset) numbers off. They need to be able to add/subtract
change what they want to be updated.
So basically I want to take the attached code and make it dynamic. The
CourseID is used by all groups. That is the one part that is used
universally-it's the subgroups of this courseid that is unique to each
group. (ie: each have reading as a course- but the reading skills are
differnt for each of my four groups). So I'd like to make it something
like
<CFIF CourseID=1>
<CFSET SkillOffset=#skilloffset#>
</CFIF>
I keep getting when I try to make it dynamic-"indexes must always
start with 1..." Any ideas? Thanks,
j
<!---Sets up SkillOffset. SkillOffset will set where in the list the
update should occur.
This will depend on which course they are updating.--->
<CFPARAM NAME="SkillOffset" Default="">
<CFIF CourseID IS 1 or CourseID IS 2>
<CFSET SkillOffset=0>
<CFELSEIF CourseID IS 3 or CourseID IS 4>
<CFSET SkillOffset=14>
<CFELSEIF CourseID IS 5 or CourseID IS 6 or CourseID IS 7>
<CFSET SkillOffset=25>
<CFELSEIF CourseID IS 8>
<CFSET SkillOffset=39>
<CFELSEIF CourseID IS 9>
<CFSET SkillOffset=47>
</CFIF>
<!---Query loop to perfomr the update on the Grades table--->
<CFLOOP INDEX="X" FROM=1 TO="#ListLen(GradeforSubject)#">
<CFQUERY NAME="EditGrades" DATASOURCE="#Request.maindsn#">
UPDATE Grades
SET GradeForSubject='#ListGetAt(attributes.GradeForSubject,X)#'
WHERE PERMNUM='#CLIENT.PERMNUM#' and SkillID=#Evaluate(X +
SkillOffset)#
</CFQUERY>
</CFLOOP>
----------------------------------------------------------------------------
----------------------
<!---In case you need it this is from my display page---->
<TABLE border>
<CFOUTPUT query="Subjects" group="SkillID">
<TR>
<TD colspan="2">#Skill#</TD>
<CFOUTPUT>
<TD>
<CFIF Val(GetSubjects.GradeForSubject)>#GradeForSubject#
<CFELSE>
<INPUT type="Hidden" name="GradesID" value="#GetSubjects.GradesID#">
<INPUT name="GradeForSubject" value="#UCase(GradeForSubject)#"
size="5">
</CFIF>
</TD>
<CFSET CourseID=GetSubjects.CourseID>
<CFSET PERMNUM=GetSubjects.PERMNUM>
<INPUT type="HIDDEN" name="CLIENT.PERMNUM" value="#CLIENT.PERMNUM#">
</CFOUTPUT>
</TR>
</CFOUTPUT>
</TABLE>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists