LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Data Older Than and Younger than.

Hi,

 

I have created a program that checks for files from different folders and copies them according to different conditions. The conditions are data older than and younger than If i press data older than button, it goes to the event data older than. Then inside 2 for loops, 1 for loop for it to loop through the folder and 2nd to loop through the files in the folder. Inside the second loop it checks whether each file is older than a particular data given by us. Now the problem is I have to keep the copy file outside of all this things, because this is going to part of another program, so copy has to be outside. But I cant do it. If i disable indexing in the output part of each loop then only the last file will go. I need all the files to copy and copy part must be oustide. Also its very important it has to be the event structure data older than and data younger than. Because in the main program i use event and 1st even is all data, which I accomplished. My second event is data older than and 3rd event is data younger than. Besides the event structure and, anything else can be changed inside the event structure. I have been trying all methods but couldnt get it. Please help me to do the same. I have attached the file. Thanking You. 

0 Kudos
Message 1 of 5
(2,805 Views)

Hi vindsan,

 

What version of LabVIEW are you using? Starting with LabVIEW 2012, you can configure the FOR loop output terminal to conditionally add elements to the array, eliminating the need for the case structure. You can also concatenate the the arrays which are being written to the output terminal of the outer FOR loop, so the resulting paths will be stored in a 1 dimensional array.

 

http://zone.ni.com/reference/en-XX/help/371361J-01/lvhowto/condacc_valuesnloops/

http://zone.ni.com/reference/en-XX/help/371361J-01/lvhowto/autocat_arraysnloops/

 

copy1.png

 

Also remember that the File Copy operation works on a single file at a time, so you will need to place this in another FOR loop to copy each file in the array:

 

copy2.png

Message 2 of 5
(2,775 Views)

Unfortunately, the Original Poster was using LabVIEW 2011.  Your array of Paths should work, but if you indicate an excluded file by making its Path the Null path, then in your For loop that copies each file, you'll need a Case Statement to "not copy" the Null files.  Alternatively, as Mateh suggested, you could "selectively" build your Array to include only "good" Paths.  In the absence of the Conditional Indexing tunnel (one of 2012's Great Ideas), you can use a Shift Register, initialized to an empty array of Paths, and append a path only if it meet the Date criterion, in effect making your own Conditional Indexing system.

 

Bob Schor

Message 3 of 5
(2,754 Views)

Dear Mr Schor,

 

Unfortuately my labview is 2011. I am sorry I didnot get that shift registers part. Can you please explain it to me, how can I do that .  Because shift registers will replace the previous value when the new value comes. When I initalized the shift register to an array of paths, at the output part of the shift register it shows a broken wire, because only a single path is coming out of each loop, but the shift register is expecting an array every time since I intialized with array of paths. How can I do this.  Thanking You.

 

Vindsan

0 Kudos
Message 4 of 5
(2,713 Views)

Or else I will give you the whole project. The project is send files over tcp/connection to backup the files in a network hard drive. So I have created a program that has a client server system where as u know the server will send the files using tcpip connection and the client will accept the files and store it in the network hard drive. I have four conditions. The conditions are copy all data, copy data older than a date or younger than a given date (which Iam attempting to do now) and later on defined data, which is u will be able to select which folder you want to copy. I have done the first condition that is all data. As u can see from my attached program a single path is going out of the all data event. Now I have to create 2 more events data younger than and data older than where the output of that will be connected to that single path going out of the even structure. Iam trying to combine the two programs. That is insead of the copy file, I will be having rest of the program from the main proram which is client and server together solved.  So that is what Iam trying to achieve. Please help me. Thanking You.

 

Vindsan

0 Kudos
Message 5 of 5
(2,696 Views)