Jump to content

Combine Header and Characteristics At .txt Report


---
 Share

Recommended Posts

Hello all,

As a customer request, We need to get a .txt report that includes header and characteristics combined.

As seen below, We are getting two separated reports .hdr and .chr. Is there any way to combine them?

3938_685e9c82c47352731e2e3a61514a5616.png
Link to comment
Share on other sites

Well, it's almost christmas so lets be helpful...There are a million different ways, one way, (not unlikely a solution thet I would use my self if I had to do this) is to let a batch file do it.

Content of batch-file:
type *.hdr >merge.txt & echo. >>merge.txt
type *.chr >>merge.txt
Just remebered that you dont need the for command.... 😃
Link to comment
Share on other sites

Please sign in to view this quote.

Wish you all happy christmas! I simply have no idea where to paste these codes. Could you help me with the details please?
Link to comment
Share on other sites

Create a textfile, paste the content, change the file ending from ".txt" to ".bat" or ".cmd". Place it in the same foler as your chr and hdr files and run it.


(I would how ever encourage you to google the function of it, before you execute it, so that you know what it does. Don't run code you don't understand, is a good general rule)
Link to comment
Share on other sites

A report that looks like this?
150_81cc74995842132c432e92038d9ef3e6.txt
If so:

Resources > Design custom report > Report header compact report > protform > default_compr_refer.
Resources > Define report > Compact report > All characteristics.
Measurement tab > Multiple report drop-down > Default compact report > Format drop-down > default_compr_refer.
Range drop-down > All characteristics.
Link to comment
Share on other sites

Hello Zafer,

why don't you use the method Eric proposed?
You can automate the process by creating a batch-file called "report_end.bat" in the dictionary of your inspection with Eric's code.
For Instance, if your hdr- and chr-file are created in the folder C:\Temp\ and you also want to output the merged file in the folder, the modified code is as follows:
type C:\Temp\*.hdr >"C:\Temp\merge.txt" & echo. >>"C:\Temp\merge.txt"
type C:\Temp\*.chr >>"C:\Temp\merge.txt"
del "C:\Temp\*.hdr" 
del "C:\Temp\*.chr"
The del-command deletes the hdr- and chr-file afterwards.

Unbenannt.JPG

Link to comment
Share on other sites

  • 3 weeks later...
Thank you! But the problem is, both of my files are .txt. They are like:

132131_hdr.txt
132131_chr.txt.

File types are txt, so i could not find a command that works.
Link to comment
Share on other sites

As far as i tried you would need to download "findstr" to be able to further search.
We use LUA for some qdas editing. If you are ok with using LUA, then i can make a script for you - tomorrow
Link to comment
Share on other sites

I believe the issue is a typo based on a misleading description & screenshot
  • Screenshot and description shows .hdr and .chr
  • Recent reply spells out they all end in .txt

Please sign in to view this quote.

Please sign in to view this quote.

Please sign in to view this quote.

This needs to change to make the original solution work:
  • *.hdr → *_hdr.txt
  • *.chr → *_chr.txt
The following combines ALL files ending in _hdr.txt and _chr.txt into a new file called merge.txt

:: combine-hdr-chr.cmd
TYPE *_hdr.txt > merge.txt
TYPE *_chr.txt >> merge.txt
In case you need to separate out individual part reports... here's a more interactive version:

:: interactive-combine-hdr-chr.cmd
@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION

:: Ask for source file name
ECHO Example part file name:
ECHO file1_hdr.txt
ECHO ^^^^^^^^^^
SET /P partname="Enter the name of the part files: "

:: Ask for combined file name
SET /P filename="Enter the name of the combined file: "

:: Combine files to entered file name, .txt appended
TYPE "%partname%_hdr.txt" > "%filename%.txt"
TYPE "%partname%_chr.txt" >> "%filename%.txt"

ENDLOCAL
EXIT
Will likely need to https://support.microsoft.com/en-us/windows/common-file-name-extensions-in-windows-da4a4430-8e76-89c5-59f7-1cdbbc75cb01 to save and rename the attached .txt files as .cmd – wise forum rules don't allow .cmd attachments

combine-hdr-chr.txtinteractive-combine-hdr-chr.txt

Link to comment
Share on other sites

 Share

×
×
  • Create New...