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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Suggested data structure advice....

Status
Not open for further replies.

DunLudjin

Technical User
Jun 17, 2009
11
US
I have a text report from some software. I'm trying to collect the data from the text file into a meaningful data structure and I would like some suggestions for this. The data is set in a text file as follows:
==========================================================
Item* Part#*Plant......................... XPL Description.............. Quantity.. Rev# Ref.Desig/ECO#.Date/Alt.Parts.Qty
Notes.....

1 .2605009000 VALVE,CHK, VACUUM 1.0000 00 V6------------DECARBONATOR VENT CHECK VALVE

VALVE,CHECK,VACUUM,01.000"OD,FOR STANDARD TRI-CLAMP
FERRULES,FDA EPDM SEALS,FDA VITON SEAT,1/8PSI CRACKING
PRESSURE,316SST

NOTE TO VENDOR: VALVES TO BE TAGGED WITH MECO PART NUMBERS

CHECK ALL VALVE #SCV-100-SS-FV-1/8

2 .2604826000 VALVE,DPH, 00.500"TC 1.0000 5 V8------------DISTILLATE PUMP CASING DRAIN VALVE

VALVE,DIAPH,00.500"TRI-CLAMP,316LSST FORGED BODY,TEFLON
DIAPHRAGM W/EPDM BACKING,25RA FINISH INTERIOR,FOUNDRY
FINISH EXTERIOR,WITH PAS PLASTIC BONNET

NOTE: CMTR FOR BODY,C OF C FOR FDA CFR 21 AND
USP CLASS VI MUST ACCOMPANY VALVE

ITT PURE-FLO #.5-F-419-6-0-0-TM17-963-M2-SQDB-SQD18

============================================================

I've been trying to set up the structure as such

item 1 = (1, 2605009000, CHK VALVE, [V6])
item 2 = (2, 2604826000, DPH VALVE, [V8])

Now, each record will have one item number, one part number and one short description, but can have multiple tags.

Does this structure seem logical?

Shawn Way
 
It depends what you want to do with it afterwards. I can see where you get the index numbers and part numbers from, the description seems to be two fields split, reversed, and joined with a space. Everything comes out of one line, and the rest of the report can be discarded. The V6 and the V8 are confusing me - when you say 'multiple tags' does that mean that you can have multiple lines for the same thing that you want to consolidate into
Code:
item 1 = (1, 2605009000, CHK VALVE, [V6,V8])
for example? If not, then a simple array of arrays will do what you want.


Steve

[small]"Every program can be reduced by one instruction, and every program has at least one bug. Therefore, any program can be reduced to one instruction which doesn't work." (Object::perlDesignPatterns)[/small]
 
That is exactly what I am trying to do. In some cases I may end up with:

(1, 260...., CHK VLV,[V10,V12,V15,V16])

Afterwards I will be sorting on the short description and the 260... number, creating a LaTeX table on the result ad pulling PDF's with the 260... number.
 
The only thing I can say is sometimes if you are doing something like this it is easier to change delimiters and sometimes keeps issues down.

So this
(1, 260...., CHK VLV,[V10,V12,V15,V16])
becomes
(1, 260...., CHK VLV,V10|V12|V15|V16,)

That way if you have to split it up later your not fighting those other commas. You don't even need the [] because you know that you will always be splitting up field number X, and you can add fields later without worrying about it.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[noevil]
Travis - Those who say it cannot be done are usually interrupted by someone else doing it; Give the wrong symptoms, get the wrong solutions;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top