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

stucture vs array

Community Beginner ,
Apr 21, 2006 Apr 21, 2006

Copy link to clipboard

Copied



hello
i am still a bit confused from the 2
stucture vs array

how are these used for maybe reporting system.
like
display a query results to a page.
TOPICS
Advanced techniques

Views

327

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

correct answers 1 Correct answer

Explorer , Apr 21, 2006 Apr 21, 2006
An array is an ordered set who's indices are whole numbers. Members are referenced by a particular number.

a[1] = "John";
a[2] = "Mary";
a[3] = "Tom";

The order of an array is important.

A structure (analogous to a hash map, associative array) is a data structure who's keys or "indices" can be alpha-numeric values. The members are referenced by these values.

s["name1"] = "John";
s["name2"] = "Mary";
s["name3"] = "Tom";

One notable difference betwen the 2 In coldfusion, is that arrays are pa...

Votes

Translate

Translate
LEGEND ,
Apr 21, 2006 Apr 21, 2006

Copy link to clipboard

Copied

I consider a structure to be like a big box into which you can put variables. Then, if you send the structure somewhere, to a cfc for example, all the variables go with it.

I consider an array to a way of arranging data.

To display query results on a page, for the most part, forget arrays and structures. All they do is complicate things.

However, if you want to be confused even more than you are now, a query can be viewed as a structure containing a bunch of one dimensional arrays. The arrays are your columns, not your rows. The usefulness of this is that you can use array functions, such as arraysum(), on your query.

Didn't clear things up a bit, did it.

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
Explorer ,
Apr 21, 2006 Apr 21, 2006

Copy link to clipboard

Copied

An array is an ordered set who's indices are whole numbers. Members are referenced by a particular number.

a[1] = "John";
a[2] = "Mary";
a[3] = "Tom";

The order of an array is important.

A structure (analogous to a hash map, associative array) is a data structure who's keys or "indices" can be alpha-numeric values. The members are referenced by these values.

s["name1"] = "John";
s["name2"] = "Mary";
s["name3"] = "Tom";

One notable difference betwen the 2 In coldfusion, is that arrays are passed by value, and structs by reference.

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
New Here ,
Apr 23, 2006 Apr 23, 2006

Copy link to clipboard

Copied

LATEST
Another thing to remember when comparing the two is that ColdFusion provides a lot more searching functionality for lists and structures that it does for arrays. There are uses for both and sometimes a use for a combination. Right now I am using a security scheme that parses and array of structures. It works very nicely.

- JS

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