Jump to content

Over-write / Append


---
 Share

Recommended Posts

I'm using this to send the report to two folders. It works fine, but
the file is being over-written each time. How can I make it append?

filePath = "T:\DMR\CMM Data\100518 Op-120_Rev_A\"+ getRecordHead("planid")+ getRecordHead("partnbinc")+".txt"

if fileExists(filePath) then // if it can't find the file then it will not error out.

if Part_Type == "Set-up"
copyFile(filePath,"T:\DMR\CMM Data\100518 Op-120_Rev_A_Set-up\theresults.txt")
else

endif
if Part_Type == "Production"
copyFile(filePath,"T:\DMR\CMM Data\100518 Op-120_Rev_A_Production\theresults.txt")
endif //inquireList

else
message("could not find file : " + filePath)
endif //fileExists
Link to comment
Share on other sites

You need to parse the new file and add the content to the existing file.

You will need readListFile() and addToFile().

Here is a small example for you to play with:
if Part_Type == "Set-up"
	content=readListFile(filepath)
	for i = 1 to content.size
		addToFile("T:\DMR\CMM Data\100518 Op-120_Rev_A_Set-up\theresults.txt",getParameterNamed(content,i))
	next i
else.....
or
addToFile("T:\DMR\CMM Data\100518 Op-120_Rev_A_Set-up\theresults.txt",readListFile(filepath))
Link to comment
Share on other sites

 Share

×
×
  • Create New...