Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Data Structures

Posted on 2014-11-12
1
Medium Priority
?
87 Views
Last Modified: 2014-11-13
How can i build a data structure which more reflects something like a one to many
kind of thing. Like i have a person who can have more then 1 address, how can i store
this in a structure ?

<!---- Create a Name structure --->
<cfset nameCLK=StructNew()>
<cfset nameCLK.first="Chris">
<cfset nameCLK.middle="Lloyd">
<cfset nameCLK.last="Gilson">
<!--- Create an address struct --->
<cfset addrCLK=StructNew()>
<cfset addrCLK.street="17 Gigantic Rd">
<cfset addrCLK.city="Watertown">
<cfset addrCLK.state="MA">
<cfset addrCLK.zip="02472">
<!---- Create a Person structure --->
<cfset personCLK=StructNew()>
<cfset personCLK.name=#nameCLK#>
<cfset personCLK.addr=#addrCLK#>

Open in new window


what if i now have a second address i like to add to the address Structure ?
0
Comment
Question by:AlexPonnath
1 Comment
 
LVL 39

Accepted Solution

by:
gdemaria earned 2000 total points
ID: 40438460
create an array within your structure...

<cfset personCLK=StructNew()>
<cfset personCLK.name=#nameCLK#>

<cfset personCLK.addr=arrayNew(1)>
<cfset personCLK.addr[arrayLen(personCLK.addr)+1] = addrCLK>
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hi, Even though I have created this Tutorial on My personal Blog, Some people might not able to find my website, So here i am posting it again Today, from the topic it is very clear that i will be showing you here the very basic usage of how we …
I spent nearly three days trying to figure out how incorporate OAuth in Coldfusion for the Eventful API. Hopefully, this article will allow Coldfusion Programmers to buzz through the API when they need to. Basically, what this script does is authori…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question