Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Returing Directory List as an array

Status
Not open for further replies.

jrottman

Programmer
Jun 17, 2005
47
I have a field in my db that is a list, the list contains all the information of spcecfied directories on my server. I store this list in my db under the field fld_docDisplay.

In each of my test folders I have sub-directories that I am using to organize the files I received by my paperless fax system.

So it looks something like this.

S060099 (file number)
AD (sub directory)
200050501.tif (file I have received and processed)
PC (sub direcetory)
300060604.tif (file I have received and processed)


What I am trying to do is from the list I store in my db, return the list as an array.

Here is the code I am trying to use. Would it be better to store the directories as one list, then store the files as another list.

<cfquery name="test" datasource="#application.dsn#">
select fld_docDisplay from tbl_smartPanel_propInfo_Sale
where fld_fileNum = 'S060099'
</cfquery>


<cfset directoryArray = arrayNew(1)>
<cfloop from="1" to="#ListLen(test.fld_docDisplay)#" index="NDX">
<cfset directoryArray[ndx] = structNew()>
<cfset directoryArray[ndx].DirName = ListGetAt(test.fld_docDisplay,NDX)>\
<cfset directoryArray[ndx].FileName = ListGetAt(test.fld_docDisplay,NDX)>
</cfloop>

<cfdump var="#directoryArray#">
 
Please appologize, but I think that instead of storing the files info in one field, would it be better if you have a DocumentID Table related (one to many) to DocumentPath table?

Regards,
mansii
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top