Home
Username:
Password:
Adobe ColdFusion 8 Tutorials

Expressions / Lists




Visitors to VTC.com will be able to view all introductory videos for each training course.
Free Trial Members will gain access to first three chapters for each training course.
Full Access Members have full access to VTC.com’s entire library of video tutorials.


Learn More

Subtitles of the Movie

We are going to take a look at Lists in ColdFusion and working with Lists, also a few of the Functions in working with Lists. So, what is a List- A List is simply a sequence of values that you assign to a single variable name. I'll show you some examples once we've talked about this. A sentence is really a list delimited by spaces. A Sentence consist of a word and a space, in other words space, so you can use that space within the sentence to tell ColdFusion to segregate out each individual word. This is a great method to use for parsing text files if you get a text file returned from a system. A text file quite often has sentences, so you can use the period at the end to segregate the sentences. And you can use spaces between words to segregate the words themselves. ColdFusion has built-in Functions to work with List. There's a few of them listed on the page here. And you create a List no different in creating a Variable. Now, there are some things that ColdFusion creates Lists automatically for. And those are form fields as an example, checkboxes where the user has to check multiple items- those multiple items are stored under a single variable name, multiple select items, et cetera. So, here are a few List Functions. There're a lot of them in the Functions area, in the ColdFusion Reference. ListLen gets the number of elements in a list. ListLast, ListDeleteAt, what you do is mention which character in a particular position you want and you can pull Add, Delete information from a list. So, let's take a look at this List down here in Code View. And what I actually have is cfset. I've created a List Variable called fish. And inside of that, I have put 6 different types of fish. Now, what this is doing is populating out the information within that list in using LisetGetAt and ListLast. So, let's run this in the browser and see what it ends up looking like. So, I move this over here for you. So, my fish list is- and notice it puts all the items in the list into my sentence and that is by just naming the variable and it puts all of the items in. First item in the list, I'm using ListGetAt and the first item. ColdFusion begins with number 1, not 0 as some other languages do. So, if I want the first item in the list, I put a 1. Last item in the list is ListLast. You put the list name you want and the last item is parrotfish as you can see right here. So, it's fairly simple to work with Lists in ColdFusion and this is an example of just a few of the Functions. Where this comes in handy is if you need to pars text files and working with form fields. Those are generally the 2 areas where I'm definitely working in List and List Functions. So, those are Lists in ColdFusion.

Tutorial Information

Course: Adobe ColdFusion 8
Author: Candyce Mairs
SKU: 34093
ISBN: 1-936334-05-4
Release Date: 2010-02-26
Duration: 8 hrs / 112 lessons
Work Files: Yes
Captions: Available on CD and Online University
Compatibility: Vista/XP/2000, OS X, Linux
QuickTime 7, Flash 8

VTC Sign up & Benefits

  • Unlimited Access
  • 98,729 Video Tutorials (23,265 free)
  • Video Available as Flash or QuickTime
  • Over 1026 Courses
  • $30 for One Month Access
  • Multi-User Discounts Available