Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Build simple associate array > relationship

Status
Not open for further replies.

Extension

Programmer
Joined
Nov 3, 2004
Messages
311
Location
CA
Hi,

I'm trying to build a relationship within an associate array but I'm just not getting there.
I have a flat file which contains data in the following stucture (see below).
Now I want to build a hash and then display the relationship; but only display starting at LEVEL 1 (not LEVEL 0) and sort it A-Z.

Any help would be really appreciated.

Code:
__DATA__
ID|NAME|SUB_ID|LEVEL
16|Internet|12|1
20|Software|12|1
24|Microsoft|20|2
28|Oracle|20|2
32|Google|16|2
36|Yahoo|16|2
40|Amazon|16|2
12|IT| |0
44|Finance| |0
48|Goldman|44|1
56|FirstBank|48|3
52|Credit Suisse|44|1

Code:
- Finance (44)
	- Credit Suisse (52)
	- Goldman (48)
		- FirstBank (56)
- Internet (16)
	- Amazon (40)
	- Google (32)
	- Yahoo (36)
- Software (20)
	- Microsoft (24)
	- Oracle (28)
 
Sorry for the big mistake; I obviously mean "associative array" instead of "associate array".

 
We get many people wanting their homework assingments completed for them without putting any effort in themselves. If you at least post the code you have been using it shows some effort on your part and people will help you. If this is not homework I hope you understand my concern, but still please post any code you have already written.
 
Why are you not reusing the code from the last time you posted a similar problem?

It will need to be modified a bit, but everything is there you need. Look at your old post thread219-1128663 and try to fix it up for what you want to do.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top