Append Header Record to Detail

B

banker123

I need to append the header record to the detail records in a
hierarchical report to create a database table. I was hoping their was
a command line tool that may assist.
Thanks!

Input:
Header 1
Detail 1
Detail 2
Detail 3

Header 2
Detail 1
Detail 2

Output:
Header 1 Detail 1
Header 1 Detail 2
Header 1 Detail 3

Header 2 Detail 1
Header 2 Detail 2
 
B

beerwolf

banker123 said:
I need to append the header record to the detail records in a
hierarchical report to create a database table. I was hoping their was
a command line tool that may assist.
Thanks!

Input:
Header 1
Detail 1
Detail 2
Detail 3

Header 2
Detail 1
Detail 2

Output:
Header 1 Detail 1
Header 1 Detail 2
Header 1 Detail 3

Header 2 Detail 1
Header 2 Detail 2

I'm surprised that nobody has suggested a program, as this seems
to me to be a problem that others would have had before. However
I haven't found anything either, so maybe I'm being over optimistic.
I found a reasonable way of doing it with Excel, using a combination
of formulas in two columns. I think my approach could easily be
turned into a macro, but I'm no Excel guru. If you have Excel, you
would probably get some good answers in the Excel groups.

If it can be done with Excel, it could probably be done also with
Open Office. But I don't have that installed at present, so can't
test my assertion.

I *could* build it for you using C++, though it would be a bit
like using a sledgehammer to crack a walnut. It would probably
take me about 15 minutes. If you want to pursue that option
instead of using a spreadsheet, get back to me offline. My email
works if you follow the instruction in my sig.
 
A

Al Klein

I found a reasonable way of doing it with Excel, using a combination
of formulas in two columns. I think my approach could easily be
turned into a macro, but I'm no Excel guru.

Turn on Macro Record. Do it. You now have a macro to do it. (I'm
not an Excel guru either, but it's a little trick I picked up to
automate Office programs.)
 
B

beerwolf

Al said:
Turn on Macro Record. Do it. You now have a macro to do it. (I'm
not an Excel guru either, but it's a little trick I picked up to
automate Office programs.)

I know about recording macros, but my problem is with generalising them.
For example, I record a macro to manipulate 20 rows of data. How do I
generalise it to work on 100, 1000 or 10,000 rows?
Answer: Change the macro in the Visual Basic editor. I really really
dislike Visual Basic. So I usually solve my data manipulation problems
by writing C++, because I can.

I have probably wasted many hours of my life. But I'm a happier person.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top