LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Update file name

Hiiii, Ray

                 This thing is same as i want but i ve seen that is writing the only one row in the excel file and then new file starts to write, so is there any possibility that it writes the whatever data i want and then when control comes back to here it creat the new filw and i think it is happening, i think i should change your file like this, i ve attached here, when stop button pressed control should come back to the caller and will create the new file...? isn't it?

Thanks,

Nishant

Message 41 of 94
(2,088 Views)
Good morning Nishant,
 
I looked at your attached vi.  You shouldn't place a while loop around the file creation routine, because it will try to create the same file a number of times until you press stop.  I didn't run it, but this will (may) create headaches for you.
 
Actually, you should run the top-level vi which is "create file main.vi". 
 
Are you trying to create a multiple-row header for the file?   Let me know and I can modify the vi to show you how it is done.
Also, it is not necessary for these vi's to continue running after they have executed.  They are meant to go into a higher level vi which takes care of when new files should / are created.
 
 
I am curious, how does the header information get populated? Is it operator entry, info in a database or is it some other means (reading a file, barcode scanner, etc?) ?
 
Ray
 
Message 42 of 94
(2,083 Views)

Hiiii, Ray

               Good Morning to u first of all, here why i am using the while loop is i am not writing the Header only, i am also writing the data also into it, and ur vi is perfect for my application, what it is doing is creating the file, writing the header into it, afterwards data into it and then i ve put the logic that whenever the file size exceeds, the control comes back to the Create file main.vi, and it creates another file, and again goes to my vi, which again writes the header and data into it and when it completes those things again come back to the main vi.

               Another thing i want to ask is, is there any possibility to reset the file nos, mean is it possible to after creating suppose 15 no of files, can we again create the file no1 programatically (not by deleting manually from the folder)?, mean by resetting the file number.

Thanks,

Nishant

Message 43 of 94
(2,092 Views)
Good morning Nishant,
 
You should use the files (vi's) before the loop.  The loop would only write data to the file.  I will try to create another layer (upper layer) to illustrate.  Maybe during lunch today 😉 
 
I understand what you are getting at...  You want to do the following:  First initialize your test, create a new file with header, go into a loop that collects data and manages the file (write data, monitors size, closes file and CREATE a new one if it is full), completes actions..  Okay, I see why you wanted to place the file creation within that loop.  There is a better approach...  basically, it consists of an external loop that is controlled by the operator, as you have done, but there is a case which selects if a new file should be created or if it is time to log data.  One Case Statement will work for this... not that complicated, actually..
 
One question that I still do not understand is if the header is multiple lines or a single line.
 
 
"Another thing i want to ask is, is there any possibility to reset the file nos, mean is it possible to after creating suppose 15 no of files, can we again create the file no1 programatically (not by deleting manually from the folder)?, mean by resetting the file number."
 
Yes, you can do this, but remember that you cannot have two files with the exact same name, so either rename the original file or create a variant on the new filename.  Resetting the number can be done by adding a Case that resets the number as soon as the max value is reached.  Maybe I'll toss that into the next example. 
 
I will modify the last ones I submitted.
 
Regards,

Ray
Message 44 of 94
(2,090 Views)

Hiii,

        Ray, let me give you the answer of the question of the Header length, actually it is only of one line, and other lines are the data and whenever the file size exceeds, at that time new file will be created with another single line of header.

     Another thing i understand that, ya user cannot create the two files of the same name, but i want that once i reset the file name, whole of the file which are currently existing in the directory should be deleted from that folder...Smiley Mad is it possible???

        Hey Ray, another thing i want to ask you that at which Canadian time, u r being online, coz i want conversation with you one on one for this topic or can u be online at the night if u can we have the conversation, i think canada is 8 to 9 hours behind then India, isnt it, and let me tell u that i m really happy that masters are helping me so much, do u ve the yahoo id, if u have then we can chat...??

Thanks,

Nishant

Message 45 of 94
(2,081 Views)
Hiii, Ray
 
        I have another question of putting the loop o/s the loop of create file main.vi, is it possible, bcoz i am writing the files only when the trigger comes, so that i m putting the loop o/s bcoz if the trigger comes, data should be written in the file and thats where file increment will come into the picture and whenever the trigger stops, the file written will be stop and i have to stop the file increment and for that what i should do i mean to stop the file increment vi, coz create main will be my main vi used in the programme and in which i ll call the file writing vi, so initially i have to stop the create main vi, which will automatically stops the file writing.
 
Thanks,
Nishant
Message 46 of 94
(2,081 Views)

Hi Nishant,

I am not sure how many hours difference we are from India.  8 hours sounds right.. but I will check.   I do have an account with Yahoo, but never go online with it.. Unfortunately, my evenings are dedicated to a project that I must complete by the end of June. 

I will try to prepare an example to explain how to do what we discussed. 
 
One consideration is how often (fast) data is collected and written to file, also what is the duration of a single data collection exercise.  The reason for asking is whether to open the file, write data, close the file & repeat;  OR open the file, write lots of data for a short period, complete the data logging, then close the file.. 
 
A control can be used to let you experiment with max. file sizes..
 
I will try again today at lunch to prepare an example.  😉
 
Take care,
 
Ray
Message 47 of 94
(2,078 Views)

Hi Nishant,

Apparently, 12 hours separate us!  That means you're on the other side of the planet  😉

I didn't get a chance to do the example today.  I will try 1st thing in the morning (with a coffee)

😄

Message 48 of 94
(2,073 Views)

Hiii, Ray

      Its OK, just send it to me whenever you create it, but here one problem is coming when i am using your vi in my project, whenever create_main.vi calls it stops my whole exe, so is there any other possibility that, as we are calling the Write_header into Creat_main... instead calling Create_main into Write_header file, when writing the data, in between increment the file no, instead of while increment the file no, inbetween writing data...

Thanks,

Nishant

Message 49 of 94
(2,068 Views)

Hi Nishant,

In the example that i will create, I will leave blocks in to simulate data collection & writing.  I will try to do it in such a way that you can drop it in to a higher level vi.  Actually, I will create a higher level vi & call it "higher-level.vi"  😉

You can also replace the data collection vi with your method..  I will try to allow configuration of the header info as well...  this is a good refresher exercise for myself, especially since I've been coding in CVI over the past year..  I like these examples to keep my mind refreshed with LV.  😄

Thanks!!

Ray

 

Message 50 of 94
(2,054 Views)