cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
BTeague
Level II

Looking to bypass or accept duplicate files

I'm currently writing code to pull the files with the same ending into one concatenated file. I'm noticing that when it gets to a duplicate file, the code breaks. Is there a way I could code this to accept the duplicate file as well? I know it may be as simple as renaming the file, but I wanted to reach out for answers first. 

 

 

If(
	N Items(lotFiles) == 1, CalibrationTable = lotFiles[1],
	N Items(lotFiles) > 1,
		CalibrationTable = lotFiles[1] << concatenate(lotFiles1, create source column);
		For(i = 1, i <= N Items(lotFiles), i++,
			Close(lotFiles[i], nosave)
		);,
	N Items(lotFiles) == 0,
		Print("no lot data, please try again");
		Return(0);
);
2 ACCEPTED SOLUTIONS

Accepted Solutions
txnelson
Super User

Re: Looking to bypass or accept duplicate files

You have a list of files called 

     lotfiles

and you reference it using a subscript when referring to a single element, and without a subscript when referencing the entire list.  However, you also have a variable referenced as

  lotfiles1

is this an error?

Jim

View solution in original post

pauldeen
Level VI

Re: Looking to bypass or accept duplicate files

It looks to me like your second if statement needs work, maybe something like this:

If(
	N Items(lotFiles) == 1, CalibrationTable = lotFiles[1],
	N Items(lotFiles) > 1,
		CalibrationTable = lotFiles[1];
		For(i = 2, i <= N Items(lotFiles), i++,
			 CalibrationTable << concatenate(lotFiles[i], create source column);
			 Close(lotFiles[i], nosave)
		);,
	N Items(lotFiles) == 0,
		Print("no lot data, please try again");
		Return(0);
);

View solution in original post

2 REPLIES 2
txnelson
Super User

Re: Looking to bypass or accept duplicate files

You have a list of files called 

     lotfiles

and you reference it using a subscript when referring to a single element, and without a subscript when referencing the entire list.  However, you also have a variable referenced as

  lotfiles1

is this an error?

Jim
pauldeen
Level VI

Re: Looking to bypass or accept duplicate files

It looks to me like your second if statement needs work, maybe something like this:

If(
	N Items(lotFiles) == 1, CalibrationTable = lotFiles[1],
	N Items(lotFiles) > 1,
		CalibrationTable = lotFiles[1];
		For(i = 2, i <= N Items(lotFiles), i++,
			 CalibrationTable << concatenate(lotFiles[i], create source column);
			 Close(lotFiles[i], nosave)
		);,
	N Items(lotFiles) == 0,
		Print("no lot data, please try again");
		Return(0);
);