02-10-2007 07:53 PM
02-12-2007 12:17 AM
Hi Kdog,
1) Would I have to install labview on the linux machine for it to communicate with the windows machine?2) Once the TCP/IP connects and opens the specified port, what functions do i need to call to retrieve my file data( stored in the root directory). Pls elaborate.3) Can I configure labview to update data in file on a continuous basis?4) If i am able to retrieve file, i would need to transfer this file to the Access database for sorting. can i use the retrieving/Send data to Access.vi? If so how?
1) I'd look at using telnet or FTP to pull a file off a Linux box These services are typicaly trivial to setup. Even easier (from the Windows PC) would be to run Samba (a file-server program) on the Linux box - then your Windows PC would see it simply as a network drive!
2) (Assuming you run a LabVIEW "server" on the Linux-box anyway) Once a TCPIP connection is established, you could have the Linux box wait to receive a Path-string from Windows app., then have the Linux-box read the file and send it as string. I always prefix data-strings with their length - the side expecting data (whichever) reads four bytes first, then reads that many [more] characters.
3) Probably, LabVIEW can do practically anything
- though I'm not sure what you mean. ![]()
4) You certainly can write to an Access database, but I'm not familier with the VI you mentioned - i wrote my own tools.
Cheers!
03-03-2007 01:23 PM
03-04-2007 09:44 AM - edited 03-04-2007 09:44 AM
Message Edited by Dennis Knutson on 03-04-2007 08:48 AM
03-05-2007 07:49 AM
i have downloaded and installed labSQL; there's an example of of inserting data into a table. How do i configure this vi to insert data directly from a text file into a table?
Sample data file
E0070000192AC8FF 00:32:30
E0070000242179B7 00:32:33
E007000001BC7E8C 00:32:35
E0070000242179B8 00:19:04
E0070000192AC8FE 00:32:30
I have no control over the contents(format) of this file , as its been transferred from a linux box via http. Is there a way to read this data line by line and insert into a table , with each line parsed into 2 fields( TAGID, READ TIME) .so for example, for the first line, i want to store E0070000192AC8FE in TAGID field and 00:32:30 in the READ TIME field.How do i do this?
Thanks
03-05-2007 08:33 AM - edited 03-05-2007 08:33 AM
There is no reason to read the file line by line. You should read it all at once with either Read From Spreadsheet File or Read Characters from File. If you have 8.2, the Read From Spreadsheet can be set to read and output text. Otherwise, the instructions for modifying the existing VI are on the block diagram. If you do this, then you can insert one line at a time. Something like the code below should help you get started.
Message Edited by Dennis Knutson on 03-05-2007 07:34 AM
03-06-2007 08:47 PM
03-06-2007 09:18 PM
03-07-2007 11:35 PM
thanks dennis for your help so far. I have modified the read from spreadsheet vi to ouput a 2D -array of strings , then i used the index array to split the array from 2D to 1D array ( one array containing the tag ID and the other 1D-array containing the read time). Then converted the 1D-arrays into string and parsed them into the 'format into string'.vi as inputs. For some reason , when i run the INSERT command , it can only input the first line to my table , none of the other lines show up . I get the error:
" Exception occured in Microsoft OLE DB Provider for ODBC Drivers: [Microsoft][ODBC Microsoft Access Driver] Syntax error in string in query expression '''. in ADO Connection Execute.vi"
I have connected probes to my data, , the for loop works OK, since it sends the INSERT command(with the right data appended in string) correctly. I'm not sure what the problem is.
Sample data
E007000001BC7E8B 13:06:33 ---> first line entered correctly to table
E0070000242179B7 13:06:33-->Error
E0070000242179B8 13:06:33-->Error
Note: The indent in the second/third line came with the data like that.i dont know if that might be the problem.how can i remove it ?I've tried %-s , but it doesnt seem to work.I also want to confirm if I need to enable indexing on the for loop connection between the ADO SQL Execute and ADO close Conn. blocks. I get an error everytime i try to do this.
I have attached my block diagram
Thanks
03-08-2007 01:38 AM