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

Pulling previous data - 2nd stab

Status
Not open for further replies.

JasonKaufman

Programmer
Apr 13, 2006
46
US
I am using CR XI

My data is a csv file looks like the following with "<07>" as the delimiter:
B.HL.HL: HL<07>3<07>1<07>25
B.HL.N1.N1: N1<07>WH<07><07>93<07>00806
B.HL.HL: HL<07>4<07>3<07>26
B.HL.N1.N1: N1<07>SN<07><07>93<07>00809
B.HL.HL: HL<07>5<07>1<07>25
B.HL.N1.N1: N1<07>WH<07><07>93<07>00810
B.HL.HL: HL<07>6<07>5<07>26
B.HL.N1.N1: N1<07>SN<07><07>93<07>00007
B.HL.N1.N1: N1<07>SN<07><07>93<07>00008
B.HL.N1.N1: N1<07>SN<07><07>93<07>00009
.
.
.

The end goal is to have each 2nd segment notated by 'SN' (Store#) to also show their respective Warehouse. Both numbers are located after the 4th delimter as a 5 digit code.
The Warehouse segment will have 1 or more stores associated with it in the lines below it.

The line before each Warehouse line indicate the Parent (warehouse) in the 2nd segment (example: B.HL.HL: HL<07>5<07>1<07>25 - here '5' is parent hierarchical code.)
The line after each Warehouse line indicates the reference back to the Hierarchical parent segemnt for all the Stores to follow and is in the 3rd segment.
(example: B.HL.HL: HL<07>6<07>5<07>26 - here '5' - relates back to parent, shown in previous example)

The final data would look like the following:
wanteddata_pppk0v.png


I have rewritten this completely and hopefully it is a bit more understandable now.
Please let me know if more information is needed.
Disregard the attachment.
 
 http://files.engineering.com/getfile.aspx?folder=90abac35-b5c0-4d9a-8e57-4f871e17c716&file=runningtotal.png
OK, I think I now understand the problem, and solved it by creating the following 2 formulas:

[Code {@Warehouse}]
WhilePrintingRecords;
Global StringVar WH;

If Split({Table.Customer_816_DATA}, '<07>')[2] = 'WH'
Then WH := Split({Table.Customer_816_DATA}, '<07>')[5]
Else WH := WH;

If Split({Table.Customer_816_DATA}, '<07>')[2] = 'SN'
Then WH
Else ''
[/Code]

[Code {@Store}]
If Split({Table.Customer_816_DATA}, '<07>')[2] = 'SN'
Then Split({Table.Customer_816_DATA}, '<07>')[5]
[/Code]

Hope this helps.

Cheers
Pete
 
works perfectly,
Thanks so much for your help and patience Pete!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top