Think that I hosed my profile after pretty much right after creation and posting my first question ever. Had two replies hit my mailbox but can't hyperlink back to find the Tek-Tips thread. I'm pretty out of my element data-formatting in VBS and am hoping for even a fairly representative example that is somewhat similar for me learn and apply the concepts. I see that [highlight #FCE94F]guitarzan[/highlight] tried to assist, and possibly skip, too, but I couldn't hook back to the thread. Very sorry!
What I hope to accomplish through VBScript:
1. Read vertical text-based list and convert to horizontal comma-separated records
2. Start a new record each time the value NEWREC is read/matched but throw out the value NEWREC from the final output
3. Read the DateTime* value and assign as the first field value in each new record for which there is another ITEM* to process until NEWREC is encountered to start another record
4. Read LOC* and assign as the second field value in each new record for which there is another ITEM to process until NEWREC is encountered to start another record
5. Read ITEM* and assign as the third field value
Example:
For file C:\Input.txt (treat all data elements as text, including date/time)
[highlight #BABDB6]NEWREC[/highlight]
DateTime1
LOC001
ITEM1
ITEM2
ITEM3
ITEM4
[highlight #BABDB6]NEWREC[/highlight]
DateTime2
LOC002
ITEM1
ITEM2
ITEM3
ITEM4
ITEM5
Create file C:\Output.txt (or Output.csv works, too) formatted thus:
[highlight #73D216]DateTime1, LOC001, ITEM1
DateTime1, LOC001, ITEM2
DateTime1, LOC001, ITEM3
DateTime1, LOC001, ITEM4[/highlight]
[highlight #729FCF]DateTime2, LOC002, ITEM1
DateTime2, LOC002, ITEM2
DateTime2, LOC002, ITEM3
DateTime2, LOC002, ITEM4
DateTime2, LOC002, ITEM5[/highlight]
For any code supplied, I truly will attempt to apply it and continue to grow and learn from it. If I can work through this first data-formatting challenge through suggested code, I have multiple circumstances where I will apply the concepts and learning. I'm a systems admin trying to fill some VBS shoes. I learned how to mine WMI and other information using VBS, but formatting data is pretty new to me.
Thanks much--my apologies for any oversights!
=======
Sorry that I can't seem to pull up your what I think was your response, [highlight #FCE94F]guitarzan[/highlight]:
-----Original Message-----
From: Tek-Tips Forums [mailto:noreply@tek-tips.com]
Sent: Friday, February 12, 2016 7:51 PM
To: ....
Subject: Tek-Tips VBScript Forum: VBScript (or other) to reformat vertical data list elements into horizontal comma-separated records:
guitarzan (Programmer) has responded to the question "VBScript (or other) to reformat vertical data list elements into horizontal comma-separated records:" in the VBScript forum in Tek-Tips.
Come to to view.
You were notified of this activity because you requested it. To turn off notification, log in to the Tek-Tips site click on the red checkmark next to the "VBScript (or other) to reformat vertical data list elements into horizontal comma-separated records:" thread.
Regards,
Tek-Tips Forums
What I hope to accomplish through VBScript:
1. Read vertical text-based list and convert to horizontal comma-separated records
2. Start a new record each time the value NEWREC is read/matched but throw out the value NEWREC from the final output
3. Read the DateTime* value and assign as the first field value in each new record for which there is another ITEM* to process until NEWREC is encountered to start another record
4. Read LOC* and assign as the second field value in each new record for which there is another ITEM to process until NEWREC is encountered to start another record
5. Read ITEM* and assign as the third field value
Example:
For file C:\Input.txt (treat all data elements as text, including date/time)
[highlight #BABDB6]NEWREC[/highlight]
DateTime1
LOC001
ITEM1
ITEM2
ITEM3
ITEM4
[highlight #BABDB6]NEWREC[/highlight]
DateTime2
LOC002
ITEM1
ITEM2
ITEM3
ITEM4
ITEM5
Create file C:\Output.txt (or Output.csv works, too) formatted thus:
[highlight #73D216]DateTime1, LOC001, ITEM1
DateTime1, LOC001, ITEM2
DateTime1, LOC001, ITEM3
DateTime1, LOC001, ITEM4[/highlight]
[highlight #729FCF]DateTime2, LOC002, ITEM1
DateTime2, LOC002, ITEM2
DateTime2, LOC002, ITEM3
DateTime2, LOC002, ITEM4
DateTime2, LOC002, ITEM5[/highlight]
For any code supplied, I truly will attempt to apply it and continue to grow and learn from it. If I can work through this first data-formatting challenge through suggested code, I have multiple circumstances where I will apply the concepts and learning. I'm a systems admin trying to fill some VBS shoes. I learned how to mine WMI and other information using VBS, but formatting data is pretty new to me.
Thanks much--my apologies for any oversights!
=======
Sorry that I can't seem to pull up your what I think was your response, [highlight #FCE94F]guitarzan[/highlight]:
-----Original Message-----
From: Tek-Tips Forums [mailto:noreply@tek-tips.com]
Sent: Friday, February 12, 2016 7:51 PM
To: ....
Subject: Tek-Tips VBScript Forum: VBScript (or other) to reformat vertical data list elements into horizontal comma-separated records:
guitarzan (Programmer) has responded to the question "VBScript (or other) to reformat vertical data list elements into horizontal comma-separated records:" in the VBScript forum in Tek-Tips.
Come to to view.
You were notified of this activity because you requested it. To turn off notification, log in to the Tek-Tips site click on the red checkmark next to the "VBScript (or other) to reformat vertical data list elements into horizontal comma-separated records:" thread.
Regards,
Tek-Tips Forums