Ask a Question related to Macromedia ColdFusion, Design and Development.
-
craig_uk #1
Need to Trim value in a List
I have a list that retrieves documents in a directory. <!--- Pack Directory
---> <cfdirectory action='list' directory='C:\TNS_Docs\EXCEL_PACKS' sort='type
asc' name='directory_listing'> I then have a query that checks if a user has
access to documents dependant on the first 3 numbers of the documents, i then
want to match them up and show them to the user. I need to trim the NAME value
in the DIRECTORY_LISTING so i only look at the first 3 numbers. <!--- My Query
---> <cfquery name='mylist' dbtype='query'> select name, size,
datelastmodified from directory_listing where name =
'#GET_DATA.pack_location#PACK.xls' </cfquery> Everytime I use LEFT(name, 3) I
get an error. Any ideas?
craig_uk Guest
-
trim function
Hi there, does any know how i can do a 'trim on canvas' sort of function. If my canvas is bigger than my draw/animation etc, then how do i shrink... -
Trim problem
Hi, i have another complex problem i cannot figure out. I have a string called #file_name#. The string's value is a filepath and file name of a... -
Trim Text Along a Path
I am trying to take a single letter that needs to be trimmed to fit within a circle. Essentially I want to replicate this image that I did in... -
Sizing trim marks
Is it possible to change the default stroke, offset and length of trim marks created with the trim marks filter? -
trim string
How do i cut the last 4 characters in a string? I know how to cut the 4 first, but i need to cut the last! I have a image name like testimage.gif... -
pukkel #2
Re: Need to Trim value in a List
craig_uk, the Query of Queries doesn't support every SQL statement. In fact,
it does support very little of them. (the LEFT() statement isn't one of them!)
But in regard to your problem, what do you think about turning your routine
around? Instead of getting all the files and then checking if a user may see
them, you could get only those files which the user may see. You have a query,
GET_DATA, with pack_location to indicate what packs the user may see, am I
right? You could use that GET_DATA.pack_location as a filter in your
cfdirectory tag, so it only gets those files who meet this filter. Like so:
filter='#GET_DATA.pack_location#*' Hope that helps.
pukkel Guest
-
craig_uk #3
Re: Need to Trim value in a List
Thanks for the reply. I've created a test script based on what you said.
<CFQUERY NAME='GET_DATA' datasource='TNS'> SELECT p.pack_location FROM
Users_tbl u, Pack_data_tbl p where u.user_id = 164 AND u.user_id = p.user_id
order by p.pack_location </CFQUERY> <cfdirectory action='list'
directory='C:\TNS_Docs\EXCEL_PACKS' sort='type asc' name='directory_listing'
filter='#get_data.pack_location#*'> <cfloop query='GET_DATA'> <cfdump
var='#directory_listing#'> </cfloop> I should get 2 files showing yet I get
none. ? Cheers
craig_uk Guest
-
pukkel #4
Re: Need to Trim value in a List
You have misplaced the cfdirectory tag, it should be within the cfloop..
Because I see now that users can have rights to multiple, different 'packs';
you should take into account that the cfdirectory tag only supports one filter
at a time (too bad, I think). Therfore it should be within the loop where you
output the packs.
pukkel Guest
-
craig_uk #5
Re: Need to Trim value in a List
That works, thanks for the pointers. <CFQUERY NAME='GET_DATA'
datasource='TNS'> SELECT p.pack_location FROM Users_tbl u, Pack_data_tbl p
where u.user_id = 164 AND u.user_id = p.user_id order by p.pack_location
</CFQUERY> <cfloop query='GET_DATA'> <cfdirectory action='list'
directory='C:\TNS_Docs\EXCEL_PACKS' sort='type asc' name='directory_listing'
filter='#get_data.pack_location#*'> <cfoutput query='directory_listing'>
#name#<br> </cfoutput> </cfloop>
craig_uk Guest



Reply With Quote

