• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

retrieve name from cfdirectory query

Explorer ,
Jun 05, 2007 Jun 05, 2007

Copy link to clipboard

Copied

I am querying a folder of images using the cfdirectory tag. On my page if a url parameter is not present the code grabs the "name" value of the first item in the cfdirectory query and displays it. I also have code detecting the number of the current row and sets the value of the next image to 1 + the current row. I am passing that through a URL variable to the current page where a I want to grab the "name" value of the next image which is determined by the ordinal position based off the url variable. My problem is grabbing the name value based off a the ordinal position of the record in the query. How do I do this. I though of a query of queries but I don't know how to specifiy the ordinal position I want in the Where clause. Can it be done by treating the query as a structure or an array and if so what code would I used to grab the "name" value of row x?

Thanks,

Jason
TOPICS
Advanced techniques

Views

282

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jun 05, 2007 Jun 05, 2007

Copy link to clipboard

Copied

Use array notation

<cfdirectory action="list" directory="e:\isomeDirectory" name="qryDirectory">
<cfset name2 = qryDirectory.name[2]>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Jun 06, 2007 Jun 06, 2007

Copy link to clipboard

Copied

LATEST
You can also use the startrow="" and maxrows="" attributes of <cfoutput> to set the start of your query output and how many rows you would like to display. It sounds like in your example maxrows would always be 1.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation