Read Locals (using ParallelModel) from LabVIEW
Hi
I'm trying to read Locals from a ParallelModel execution using LabVIEW.
I thought this might work:
ThisContext.Thread.GetSequenceContext(1).Locals."NameOfLocal", but it did't work
Any suggestions?
regards
Richard
Hi,
You need to used the Execution reference for the TestSocket.
Get a reference to the Thread and use Thread.GetSequenceContext() to get a reference to the SequenceContext.
Get a PropertyObject from the SequenceContext using SequenceContext.AsPropertyObject() then you can use the GetVal or SetVal methods.
Hope this helps
Regards
Ray
Regards
Ray Farmer
Similar Messages
-
Problem of security using ADO from Labview to connect to Access 2000 Data Base
I have a problem using ADO from Labview to connect to Access 2000 Data Base.
First I open a ADO_DB_Engine and create a Workspace as an ODBCDirect. After I execute the open_data_base using the workspace. Here you can specify the parameter connect with /type of connection / user / password.
The problem is the following:
Although you configure a password for the Administrator user in Access, you can read/writte to data base from Labview using ADO without any security and without putting the user and password in the parameter connect. I need to access with security to data base using users and permissions but it seems that the parameter connect does not operate.
I attach
you a example of the vis and database. Remember create a ODBC connect with BD3.mdb
Thanks a lot
Peter Mst
Attachments:
SECURITY.zip 70 KB
BD3.mdb 112 KBHi Kahn,
If you use ADODB_connection -> Connection.Open and set in connection string :
"Provider=Microsoft.Jet.OLEDB.4.0; Jet OLEDBystem Database=c:\.....\Protegida5.mdw; Password=pepe;user ID=jose; Data Source:c:\......\BD5.mdb";
and after connection.execute ->
INSERT INTO tabla1 VALUES (5,'XXX'
you will be able to access to the database with security using the provider=Microsoft.Jet.OLEDB.4.0. With this provider you have to use the path and the name of the database file c:\.....\mdb file. From this way the problem is solved. (SEE SAMPLE_ADO_W2_JET.VI).
BD5.mdb have the following administrator user: user:jose / passwordepe (Protegida5.mdw)
The problem is when you want to
use ODBC and DSN. The name of this ODBC Provider is MSDASQL;. If you use this type of connection you can not enter to the database I attach you.
This database has a new administrator owner. I deleted the default administrator. If you support the default administrator you can connect to database by ODBC / DSN but the security disappear because you can always enter to database with any password, user o PC.
FINALLY I HAVE 3 QUESTIONS FOR Application Engineers of National Instruments or someone who knows these subjects before deciding the best way to connect locally o remotely with security to Access from Labview:
1.- Is it possible to enter to Database BD5.mdb from ODBC and DSN with this owner?
2.- I want to connect remotely to Access database too. Is it possible to use Microsoft.Jet.OLEDB.4.0 using the path (.mdb file) without DSN?
3. Which is the optimal Provider for Microsoft Access?
I thank you beforehand for your technical support.
Peter Mst.
Attachments:
BD5.mdb 116 KB
Protegida5.mdw 112 KB
sample_ADO_W2_JET.vi 45 KB -
Code to read local notepad.txt from applet
Hi.
Further to my (unanswered) queries about reading a notepad.txt file from the local directory i.e. the same directory from which the html and applet were launched, the following code is supposed to be able to read the local file. It failed to do so both in Netscape 7.1 and in IE5
I've also received conflicting advices : some says we can read local files without using a signed applet or chaning the ACL, whereas others I'll need to use signed applets and / or acl to allow the applet to read a local file.
My research has shown that java applets are supposed to be able to read local files. Has something changed:
public class FileAccess extends Applet
implements ActionListener {
Button loadButton, saveButton;
TextField filename;
TextArea content;
String browserName;
boolean securitySupported = false;
public void init() {
setLayout(new FlowLayout());
Label label =
new Label("Simple file editor");
add(label);
loadButton = new Button("Load");
saveButton = new Button("Save");
add(loadButton);
add(saveButton);
loadButton.addActionListener(this);
saveButton.addActionListener(this);
filename = new TextField(20);
add(filename);
content = new TextArea(5,20);
add(content);
browserName = System.getProperty("java.vendor");
if (browserName.indexOf("Netscape") > -1)
securitySupported = true;
setSize(200, 200);
public void actionPerformed(ActionEvent evt) {
if (securitySupported) {
if (evt.getSource() == saveButton) {
PrivilegeManager.enablePrivilege("UniversalFileAccess");
try {
FileWriter aWriter = new FileWriter(filename.getText(), false);
aWriter.write(content.getText());
aWriter.flush();
aWriter.close();
catch(Exception e) {
e.printStackTrace();
else if (evt.getSource() == loadButton) {
PrivilegeManager.enablePrivilege("UniversalFileAccess");
try {
BufferedReader aReader =
new BufferedReader
(new FileReader(filename.getText()));
content.setText(aReader.readLine());
aReader.close();
catch(Exception e) {
e.printStackTrace();
else {
getAppletContext().showStatus("security not installed");
}Hi acinhk,
I read your note with great interest. I am trying to solve almost exactly the same problem as you are -
Reading a .txt file in IE5 from the same directory where the html and the applet were lauched.
Your code looks fine to me.
My code is very similar, and again generates a security exception - as I am having the same problem you had getting around Java security.
If you have been able to solve the problem, can you please let me know what you did.
Any modifications to your sample code that actually made it work would be greatly appreciated.
Also, is signing the applet to read a local file under IE5 really necessary ?
Can the file be read from the local IE file system without signing the applet ?
Please let me know your thoughts.
Thanks !
drbob -
How to freeze and unfreeze panes in window by using Excel from LabVIEW
Hello
I am creating an Excel Report file programmatically using LabVIEW. I make the row headers for the sheet and store data using the program.
The requirement that i need is that when the user opens the Excel sheet, the row heading should remain fixed at top, as the sheet is scrolled down by the user.
This is possible in Excel, by clicking on Window in the menu bar and then select Freeze panes/Unfreeze panes. The same operation i need, to be done from LabVIEW. Please let me know how this can be done.
I use LabVIEW 2009
Thank you.
Solved!
Go to Solution.Please see this discussion. TCPlomp has an example of how to achieve this.
Cory K -
Using Fieldpoint from Labview RT on a PXI System
I have a PXI system with Labview RT (PXI 8186 controller with LVRT ver 7.1).
I wanted to connect a FP remote I/O system to this controller. The Fieldpoint system I have has a FP-1000 RS-232 Network module.
I was hoping to be able to connect the FP-1000 to the serial port of the PXI-8186, and use the standard Fieldpoint VIs to write/read data (as you would from a Windows-based Labview app).
It doesn't seem to be that easy, trying to download any code with a Fieldpoint VI down to my RT target gives an error ("failed to load shared library FPLVMgr.dll on RT target device"). Looking through MAX I see that Fieldpoint drivers are not loaded on the RT target, and there is no option to load them there either.
So: Ho
w do I control my Fieldpoint units from my PXI System using Labview RT?
Any help would be much appreciated.
Thanks,
RavidHi, Ravid.
Effectively, under LabVIEW RT, you cannot use the standard FieldPoint VIs to communicate to a FieldPoint module, since they are not supported. If you have a serial module, like the FP-1000 or FP-1001, you need to use Optomux commands to interface and communicate to it. You can find great examples on how to do the communication in the Example Finder of LabVIEW >> Hardware Input and Output >> FieldPoint >> Optomux >> and use any of the examples that use VISA to communicate to the modules. To run the examples, first target LabVIEW to your 8186 and open the example. Before running it, match the baud rate and address specified in your FP-1000 with the controls in the Front Panel. Also, verify that you have either an alias defined for COM1, or use AS
RL::INSTR1 for the VISA resource name. You will need to have VISA RT installed on your RT Target to be able to run this examples.
You can find the Optomux commands in LabVIEW under the Advanced FieldPoint palette. For more information on Optomux commands, you can take a look at the FP-1000/1001 Programmer Reference Manual
Let me know if you have further questions. I hope this helps!
Gustavo Valdes
Applications Engineer -
How to read data using SQLGetData from a block, forward-only cursor (ODBC)
Hi there. I am trying to read data a small number of rows of data from either a Microsoft Access or Microsoft SQL Server (whichever is being used) as quickly as possible. I have connected to the database using the ODBC API's and have run a select
statement using a forward-only, read-only cursor. I can use either SQLFetch or SQLExtendedFetch (with a rowset size of 1) to retrieve each successive row and then use SQLGetData to retrieve the data from each column into my local variables. This
all works fine.
My goal is to see if I can improve performance incrementally by using SQLExtendedFetch with a rowset size greater than 1 (block cursor). However, I cannot figure out how to move to the first of the rowset returned so that I can call SQLGetData to retrieve
each column. If I were using a cursor type that was not forward-only, I would use SQLSetPos to do this. However, using those other cursor types are slower and the whole point of the exercise is to see how fast I can read this data. I can
successfully read the data using a block forward only cursor if I bind each column to an array in advance of the call to SQLExtendedFetch. However, that has several drawbacks and is documented to be slower for small numbers of rows. I really
want to see what kind of speed I can achieve using a block, forward-only, read-only cursor using SQLGetData to get each column.
Here is the test stub that I created:
' Create a SELECT statement to retrieve the entire collection.
selectString = "SELECT [Year] FROM REAssessmentRolls"
' Create a result set using the existing read/write connection. The read/write connection is used rather than
' the read-only connection because it will reflect the most recent changes made to the database by this running
' instance of the application without having to call RefreshReadCache.
If (clsODBCDatabase.HandleDbcError(SQLAllocStmt(gDatabase.ReadWriteDbc, selectStmt), gDatabase.ReadWriteDbc, errorBoxTitle) <> enumODBCSQLAPIResult.SQL_SUCCESS) Then
GoTo LoadExit
End If
Call clsODBCDatabase.HandleStmtError(SQLSetStmtOption(selectStmt, SQL_CONCURRENCY, SQL_CONCUR_READ_ONLY), selectStmt, errorBoxTitle)
Call clsODBCDatabase.HandleStmtError(SQLSetStmtOption(selectStmt, SQL_CURSOR_TYPE, SQL_CURSOR_FORWARD_ONLY), selectStmt, errorBoxTitle)
Call clsODBCDatabase.HandleStmtError(SQLSetStmtOption(selectStmt, SQL_ROWSET_SIZE, MAX_ROWSET_SIZE), selectStmt, errorBoxTitle)
If (clsODBCDatabase.HandleStmtError(SQLExecDirect(selectStmt, selectString, Len(selectString)), selectStmt, errorBoxTitle) <> enumODBCSQLAPIResult.SQL_SUCCESS) Then
GoTo LoadExit
End If
' Cursor through result set. Each time we fetch data we get a SET of rows.
sqlResult = clsODBCDatabase.HandleStmtError(SQLExtendedFetch(selectStmt, SQL_FETCH_NEXT, 0, rowsFetched, rowStatus(0)), selectStmt, errorBoxTitle)
Do While (sqlResult = enumODBCSQLAPIResult.SQL_SUCCESS)
' Read all rows in the row set
For row = 1 To rowsFetched
If rowStatus(row - 1) = SQL_ROW_SUCCESS Then
sqlResult = clsODBCDatabase.HandleStmtError(SQLSetPos(selectStmt, row, SQL_POSITION, SQL_LOCK_NO_CHANGE), selectStmt, errorBoxTitle)
Call clsODBCDatabase.SQLGetShortField(selectStmt, 1, assessmentRollYear(row - 1))
Console.WriteLine(assessmentRollYear(row - 1).ToString)
End If
Next
' If the rowset we just retrieved contains the maximum number of rows allowed, there could be more data.
If rowsFetched = MAX_ROWSET_SIZE Then ' there could be more data
sqlResult = clsODBCDatabase.HandleStmtError(SQLExtendedFetch(selectStmt, SQL_FETCH_NEXT, 0, rowsFetched, rowStatus(0)), selectStmt, errorBoxTitle)
Else
Exit Do ' no more rowsets
End If
Loop ' Do While (sqlResult = enumODBCSQLAPIResult.SQL_SUCCESS)
The test fails on the call to SQLSetPos. The error message I get is "Invalid cursor position; no keyset defined". I have tried passing SET_POSITION and also SET_REFRESH. Same error. There has to be a way to do this!
Thank you for your help!
Thank You! - AndyHi Apelkey,
Thank you for your question.
I am trying to involve someone more familiar with this topic for a further look at this issue. Sometime delay might be expected from the job transferring. Your patience is greatly appreciated.
Thank you for your understanding and support.
Regards,
Charlie Liao
TechNet Community Support -
How to read local drive file from jsp?
please help me
SirivaniG wrote:
anyone help me out how to read text file which is in server using jspIn Other Words "Give me teh codez"!
Make an attempt yourself (search the tutorials for some relvant examples), and then, if you still have problems, post that code and we will help, but we are not going to "give you teh codez"! Ugrent!!!!!!!!!!!! -
How to create a table in MS Access from Labview using ActiveX?
I want to transfer datas from Labview to Access using activeX method. My only problem is to find out how to create a new table (array) in Access from the Labview program.
Remarks: I use Labview 6i and MS Access 2000.
For the moment I can write and read datas of Access from Labview.
If someone could help me... that would be grate!This is off the Microsoft MSDN site "creating an external table". I think you can drop the last step.:
Open the database you want to create the table in. If it is the current database, use the CurrentDb function to return an object variable that represents the current database. If it isn�t the current database, use the OpenDatabase method to open the database you want.
Use the CurrentDb function to create a Database object that points to the current database.
Use the CreateTableDef method of the Database object to create a table definition for the Microsoft Access table.
Use the CreateField method of the TableDef object to create one or more fields in the Microsoft Access table.
Use the Append method of the Fields collection to add the new field or fields t
o the Microsoft Access table.
Use the Append method of the TableDefs collection to create the Microsoft Access table.
Use the TransferDatabase method to create the external table in the specified folder.
Use the Delete method of the TableDefs collection to delete the Microsoft Access table definition. -
Missing functionality if storing TDSM from LabVIEW
In DIAdem File Browser window is selected a file from DIAdem 11.0 Examples directory. File FFT_Expl_1 has icon with „tree pictogram“ and „tree pictogram“ can be expanded to see content of file (Time, Oscillation), bellow of File Browser is displayed many file properties. Anyway these properties are not displayed in DataPortal area?!? See picture 1.
Pict. 1
If I click on the file content in tree hiearchy channel Oscillation I can see properties for this channel and small graph with the signal preview. See picture 2.
Pict. 2
To make my own data I have used examples from LabVIEW 8.6. One of these is on the picture 3 TDMS - Express write data (time and frequency domain).vi.
Pict. 3
Every time I create TDMS data from LabVIEW 8.6 (it doesn’t matter which example I use) I see in DIAdem File Browser instead of tree icon the question mark icon?!? The question mark icon cannot be expanded by clicking on it?!? Also the amount of Shown properties is significantly lower in comparison with DIADem example files. Also no signal preview is displayed?!? How to proceed with LabVIEW and TDMS function to have possibilities of DIAdem example files?
Screenshots are in attached DOC file.
Please help
Bilik
Solved!
Go to Solution.
Attachments:
TDMS problems 2.doc 289 KBHello bilik,
Thank you for the great description of your problem, the Word document with the screen shots really helps with the troubleshooting.
It looks to me as if you haven't indexed the directory where your TDMS files are stored. The "?" icon indicates that the file is not indexed. If a file is not indexed, only a subset of the properties are shown in the dialogs.
The easiest way to solve this issue is to index the directory that contains you data files (your directory icons are grey, they should be yellow). This can be done by going to the directory (or subdirectory) in the DIAdem NAVIGATOR window, and right clocking on the directory name. From the context menu, select the function "Add Search Area ..." - your directory will then be transferred to the Search Areas part of the NAVIGATOR and all the TDMS files will be indexed. At the point the files will show all the properties and the "?" will disappear.
Let me know if that helped,
Otmar
Otmar D. Foehner
Business Development Manager
DIAdem and Test Data Management
National Instruments
Austin, TX - USA
"For an optimist the glass is half full, for a pessimist it's half empty, and for an engineer is twice bigger than necessary." -
How to use dll in Labview ?
I compile this code to dll file with VC++2010 filename is test_dll.dll .
#include "stdafx.h"
#include <iostream>
#include <Windows.h>
using namespace std;
int main(int a){
cout << "Test dll...............\n";
return a;
After that, I put Call Library Function node in editor and double click Call Library Function node. I browse test_dll.dll into Library name or path and set function prototype to int32_t main(int32_t a); but it show error Call Library Function Node 'test_dll.dll:main':function not found in libraly. How to use dll in Labview ? And I have more question is what is differrent from Tools -> Import -> Shared Library(.dll) and use Call Library Function node.
Solved!
Go to Solution.The issue you are having is that LabVIEW is not capable of using C++ DLLs directly. It only handles C DLLs. This does not mean that if you you cannot use the DLL if it's compiled with the C++ compiler as opposed to the C compiler. Rather, it means that you must take extra steps in order to use it from LabVIEW. The primary issue is that of name mangling or adornment. This is discussed here: http://zone.ni.com/devzone/cda/tut/p/id/4877. Basically you need to prepend extern "C" in front of your prototypes in your header files. I would also suggest reviewing this article: https://decibel.ni.com/content/docs/DOC-14564.
-
How to Pass Container in a queue from LabVIEW to TestStand?
I was succussful to pass simple type(string, number) using queue from LabVIEW to TestStand base on the example: Use TestStand Queue.seq.
I want to pass a container variable from LabVIEW to TestStand. But there are some errors happen.
Anyone who can help on this issue?
Thanks in advance.
Attachments:
Sequnce and VI.zip 28 KB
VI Error.jpg 61 KB
Run_time Error -17001.jpg 41 KBYou ought to have a listener somewhere that calls a function
to then set up the loaded swf. In that function you can do this
kind of thing:
var ldrmc:MovieClip;
function swfloaded (e:Event) {
ldrmc = null;
if (e.target.content is MovieClip) {
ldrmc = e.target.content as MovieClip;
If the swf was published for AS3, then ldrmc will end up
being a pointer to the root of the swf, and you can call functions
or set variables however you like. If it was an AS2 swf, ldrmc
would be null.
Inside the loaded swf you could try trace statements, to make
sure you're looking up the hierarchy far enough. Like this:
trace(MovieClip(parent.parent));
If that doesn't trace MainTimeLine, then maybe you're not
looking up far enough. Don't forget that the swf itself is in a
loader, and so may be one level down from where you thought it was. -
I'm trying to read some XML data from temperature logger over my network. I'm using LabView version 2009 sp1. I'm using the URL Get Document Vi. It works fine when using Internet sites like google or foxnews etc...
When I use it with my temperature logger most of the time I get an Error 66...but some times it does work and actually retrieves the document.
I can use the same address "http://172.22.21.68/XMLfeed.rb" (Internet Explorer or Google Chrome) in my browser and get a response every time. When accessing from my browser the server in the temperature logger does take around 6 seconds to respond, but it does respond every time.
Is the URL Get Document Vi exceeding a timeout? If so, where can I set it to wait longer?
Attachments:
Error 66.jpg 183 KBIt looks like the TCP Buffered Read has a 2.5 sec timeout, I believe that is where I had trouble as well. Try creating your own URL Get HTTP Doc vi in which you call URL Get Document in normal mode, with an appropriate number of characters to fetch (enough characters so that you capture all the important data in the XML file).
Attachments:
ex1.PNG 33 KB -
How to read current using labview 7.1 from Keithley 2400
Hi, All,
I am trying to read current out from labview 7.1. The program I wrote is attached (program.gif). But when I run this program, the error message poped out when it reach the function of GPIB write (error.gif). Can anybody help to point out what's wrong with this program?
Thanks a bunch!
Joyce
Attachments:
PROGRAM.gif 40 KB
ERROR.gif 45 KBHi, Dennis,
Thanks for replying. You reminded me of putting 24, which is the GPIB address of Keithley 2400, in the front panel. Now this error doesn't occur, but it failed when it's trying to scan the result.
I attached the program in this post. I attached the figure because i thought people couldn't open the code if they don't have the right version of LV.
Thanks,
Joyce
Attachments:
Keithleyreadcurrent.vi 63 KB -
How can I read pdf files from LabVIEW with different versions of Acrobat reader?
How can I read pdf files from LabVIEW with different versions of Acrobat reader?
I have made a LabVIEW program where I have possibility to read a PDF document. When I made this LabVIEW program it was Acrobat Reader 5.0.5 that was installed on the PC. Lather when the Acrobat Reader was upgraded to version 6.0, there was an error when VI tries to launch the LabVIEW program. And Later again when we upgraded to Acrobat Reader 7.0.5 I must again do some changes and rebuild the EXE files again
It isn't so very big job to do the changes in one single LabVIEW program, but we have built a lot of LabVIEW programs so this take time to due changes every time vi update Acrobat Reader. (We have build EXE files.)
The job is to right click the ActiveX container and Click "Insert ActiveX Object", then I can brows the computer for the new version of acrobat Reader. After this I must rebuild all the "methods" in the Activex call to make the VI executable again.
Is there a way to build LabVIEW program so I don't have to do this job every time we update Acrobat Reader?
This LabVIEW program is written in LabVIEW 6.1, but I se the problem is the same in LabVIEW 8.2.
Jan Inge Gustavsen
Attachments:
Show PDF-file - Adobe Reader 7-0-5 - LV61.vi 43 KB
Read PDF file.jpg 201 KB
Show PDF-file - Adobe Reader 5-0-5 - LV61.vi 42 KBhi there
try the vi
..vi.lib\platform\browser.llb\Open Acrobat Document.vi
it uses DDE or the command line to run an external application (e.g. Adobe Acrobat)
Best regards
chris
CL(A)Dly bending G-Force with LabVIEW
famous last words: "oh my god, it is full of stars!" -
I want to read and use some informations from a excel file
To test a graphic, i need to take a lot of numbers in a excel file...
but i dont know how to open and read this file but i dont know how...
thx for your help...Hello,
You can open, read, and even write excel files (if you write a file with extension .xls, windows will interpret it as an excel file be default) using the File I/O VIs in LabVIEW. To extract the data, all you really need to realize is that spreadsheets programs like excel store data with the following basic rules:
1. the entire spreadsheet is really just a large string - to read them, you just have to know the data you read is stored based on rules 2 and 3; to write them you just have to conform to rules 2 and 3.
2. cells in a given row are delimited by tabs (usually by default) and sometimes commas (but usually only if you set this specifically in the spreadsheet program)
3. rows are delimited by end of line characters, which will usually be one carriage return and one linefeed character in that order on windows.
In fact, for writing spreadsheet strings (which can be opened in excel) from LabVIEW, check out the Array to Spreadsheet String and Spreadsheet String to Array functions in the String Palette. That is, if you imagine the excel spreadsheet as a 2D array, those functions will essentially convert between the large string, and a 2D array in LabVIEW containing the values you would see in excel's corresponding cells.
I have attached a program that will use the array to spreadsheet string function to write an excel file containing those values - it will be named test.xls and should be on your C: drive directly. A good exercise to get started would be to write a VI using similar (some inverse) functions to read that string, and convert it back to an array.
I hope this helps!
Best Regards,
JLS
Best,
JLS
Sixclear
Attachments:
Simple Write Spreadsheet String to Excel File.vi 25 KB
Maybe you are looking for
-
I marked up and PDF created by printing from Mapquest into my Adobe Acrobat 9 Pro. I added some text using Typewriter tool, and some boxes and arrows as well. They are only visible when opened in Acrobat. When I save and send them, all of the text
-
Why there is not an option to unable the 3G and use 2G on iPhone 4S ? It's awful! When will you fix that ? What are we gonna do now? I cant believe Apple can do it, like the battery of iPhone 4S is amazing. Everyday I should charge my phone! It doesn
-
Know a good network management app?
Know a good network management app? We have a Time Capsule/router with multiple devices (MacBook Air, iPhones, iPads) plus other PCs when we have people visiting. Is there any way I can see what websites were visited through my WIFI and how much band
-
Hi, I Understand that with XML save you can insert a row into a database however I am very confused about the ability of using XML to update a record. Can I use XML save to update a record? Eg if I have a primary key will it update instead of save? A
-
Hi All. I have an application which read the contents of a directory and deletes the files in them. If the directory has subdirectories, i need to enter the subdirectory and delete the files in there too. however, I do not want to delete the director