>
> Bascially I need to check to see if any of the directorys in
> "COOKIE.DisplaySelect" (pulled in from database) matches the
> "Session.stDirFileName[i]" variable and if so,
> run the code otherwise, do nothing.
>
First up, whats with session.stDirFileName and session.stDirFileType??
<cfdirectory action="LIST" directory="d:\" name="DeeDrive" sort="dirname
ASC">
will give you a query called DeeDrive with the columns name, size, type,
dateLastModified, attributes and mode.
Just treat it like any other query.
> Something is not quite right below. I know its not doing the match
properly
> because its trying to match everything thats in
> "COOKIE.DisplaySelect" with "Session.stDirFileName[i]". Should I be using
a "IsDefined"?
>
Nope....
> <cfif Session.stDirFileType[i] eq "Dir" AND
ListFindNoCase(#COOKIE.DisplaySelect#,#Session.stDirFileName[i]#)>
>
Your code should be
ListFindNoCase(cookie.displayselect,session.stDirFileName[i]) It will look
for the contents of session.stDirFileName[i] in the list contained in
cookie.displayselect.
Ok, here's some code I cooked earlier and has risen perfectly :
<cfdirectory action="LIST" directory="d:\" name="DeeDrive" sort="name ASC">
<cfcookie name="folderprefs" value="inetpub,mysql,winnt">
<cfoutput query="DeeDrive">
<cfif DeeDrive.type EQ "dir" AND
ListFindNoCase(cookie.folderprefs,DeeDrive.name)>
#name#, #size#, #type#, #dateLastModified#, #attributes#<BR>
</cfif>
</cfoutput>
Same thing, but using CFSCRIPT...
<cfdirectory action="LIST" directory="d:\" name="DeeDrive" sort="name ASC">
<cfcookie name="folderprefs" value="inetpub,mysql,winnt">
<cfscript>
for (i=1; i lte DeeDrive.RecordCount; i=i+1) {
if (DeeDrive["type"][i] EQ "dir" AND
ListFindNoCase(cookie.folderprefs,DeeDrive["name"][i])) {
WriteOutput(DeeDrive["name"][i]&", "&DeeDrive["size"][i]&",
"&DeeDrive["type"][i]&", "&DeeDrive["dateLastModified"][i]&",
"&DeeDrive["attributes"][i]&"<BR>");
}
}
</cfscript>
I know that both of the above work. For a change I actually tested the code
before I posted it... ;oD
Both examples will return the details of only the 3 folders mentioned in
cookie.folderprefs. I should mention that IRL inetpub is Inetpub and winnt
is WINNT, so I also know that the case is being ignored correctly.
Hope this helps.
Regards
Stephen
______________________________________________________________________
Get the mailserver that powers this list at http://www.coolfusion.com
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists