How do I pass an array of strings? (Help Me... Please!!! .Read Me....)
Dear All.
Help Me...
English is not very good. Google translator is used.
How do I pass an array of strings?
Please refer to the VB program
===========================================
Private Sub m_btn_Click()
Dim nReturn As Long
Dim sPpid As String
Dim sMdln As String
Dim sSoftRev As String
Dim nCount As Long
Dim saCCodes(2) As String
Dim naPCount(2) As Long
Dim saPNames(10) As String
sPpid = "PPID001"
sMdln = "Mdln"
sSoftRev = "Rev001"
nCount = 2
saCCodes(0) = "1"
naPCount(0) = 5
saPNames(0) = "Param001"
saPNames(1) = "Param002"
saPNames(2) = "Param003"
saPNames(3) = "Param004"
saPNames(4) = "Param005"
saCCodes(1) = "2"
naPCount(1) = 5
saPNames(5) = "Param006"
saPNames(6) = "Param007"
saPNames(7) = "Param008"
saPNames(8) = "Param009"
saPNames(9) = "Param010"
nReturn = m_XGem.GEMReqSend(sPpid, sMdln, sSoftRev, nCount, saCCodes(0), naPCount(0), saPNames(0))
If (nReturn = 0) Then
Call Me.AddMessage("[EQ ==> XGEM] GEMReqSend successfully")
Else
Call Me.AddMessage("[EQ ==> XGEM] Fail to GEMReqSend (" & nReturn & ")")
End If
End Sub
=================================================
nCount, naPCount enough saCCodes, saPNames value must be sent.
How to handle an array of strings in LabView is impatient.
I want to VB program implemented in LabView.
Have you actually tried to right click on the according node parameter and select Create->Constant or Create-Control??
And I don't see any string array in the parameter list. That are all simple strings and the VB code in your first post clearly shows that the call to the function only indexes the first element of those arrays to be passed to the function, not the entire array.
If the function really reads arrays despite being declared as only taking strings then it is using some weirdo VB trickery and there will be no way to replicate that in LabVIEW.
Rolf Kalbermatter
CIT Engineering Netherlands
a division of Test & Measurement Solutions
Similar Messages
-
Using JNI to pass an array of Strings to C and back from C
I have some C code that I want to integrate with a new Java application and I need to be able to pass an array of strings to the C program and then the C program needs to be able to build an array of strings that is passed back to the Java program. I've got the first part working so that I can pass an array of strings to the C program and display them, but I can't figure out how to build the strings in C so that that when Java gets back control, it can display the strings tha were built in the C program.
Has anyone done this? Do you have some sample code?I have a program which is written in C. I can give you the whole project as it is in a zip file. You'll need VC to work with it. By the way, I am using Windows for development. Should you need it, I'll mail you the same. Give me your mail address.
-
JSP Tag- Passing an array of string as an Attribute
Can I pass an array of String as an attribute to a JSP Tag? I read the specification but It does not say any thing about this.
Thanks in Advance.I thought JSP tags had to deal strictly with string values?
-
Users of imovie experience a lot of problems and crying for help and no one at Apple did not respond
I do not understand how a company like Apple puts experts to help users
Please note that anonymous experts in Internet offer their help for moneyUsers of imovie experience a lot of problems and crying for help and no one at Apple did not respond
I do not understand how a company like Apple puts experts to help users
Please note that anonymous experts in Internet offer their help for money -
why when I press the command button and number two, yahoo comes up instead of the ‘at’ key? how can I fix the command shortcuts? help me please.
try pressing the shift and 2 key to get the @ symbol.
if that doesn't work for you - go to system preferences - keyboard and change it there.
good luck -
How do I pass an array of structs to a C function using the dll flexible prototype adapter?
What I want to do is pass into a C dll function a variably sized Array of structs of type TPS_Data. My Code compiles but when I run it in TestStand, I get an error -17001; Program Error. "Cannot allocate 0 size buffer Error in parameter 2, 'OpenFrdData'."
I've allocated the Array of structs, and all of the information is there before I call my function, so is it my prototype? Or am I asking too much of the DLL Flexible Prototype Adapter to pass an Array of Structs?
I can pass in a single struct of type TPS_Data and that works, but not an array.
Here's the relevent code:
typedef struct TPS_DATA
char Report_Number[256];
char System_Name[256];
char Open_Date[256];
char UUT_Part_Number[256];
char UUT_Serial_Number[256];
char UUT_Name[256];
char Open_Employee_Name[256];
char Open_Employee_Number[256];
char Close_Employee_Name[256];
char Close_Employee_Number[256];
char Close_Date[256];
} TPS_Data;
typedef struct TPS_DATA_ARRAY
TPS_Data DataRecord;
} TPS_DataArray;
long __declspec(dllexport) __stdcall OpenDialog (CAObjHandle Context, TPS_DataArray *TpsData[], const char *psFaultStr, char *sComments, const int nCount);OK,
I can pass the data to the DLL function, using the following types:
typedef struct StringArrayType
char string[10][256];
} StringArray;
typedef struct MultiStringArrayType
StringArray Record[10];
} MultiStringArray;
void __declspec(dllexport) __stdcall ATP_TestStructPassing(StringArray Strings)
return;
void __declspec(dllexport) __stdcall ATP_TestMultiStructPassing(MultiStringArray *Strings)
return;
But when the MultiStruct function Exits, TestStand reports an Error:
-17501 "Unexpected Operating System Error" Source: 'TSAPI'
There doesn't seem to be a way around this, and once the error occurs, I have to force quit TestStand. I've included the sequence file, and the dll code can be compiled from the fun
ctions shown above.
Any thoughts on how to get around this error would be greatly appreciated.
Attachments:
StructArrayPassing.seq 16 KB -
How do I resize an array of strings in a CIN ?
I've been using a call to NumericArrayResize() to allocate enough memory for numeric arrays, but I now have an array of strings that I need to build in a DLL/CIN and pass back to Labview. Can someone point me to a snippet that will demonstrate how to populate an array of strings with data?
Kindest,
WarrenCheck the follwing example. It may be what you want:
Using a CIN to Create an Array of Strings in LabVIEW
http://zone.ni.com/devzone/devzoneweb.nsf/opendoc?openagent&AD517F5DCCAF70228625683A000A570F&cat=2F4F574886553A62862567AC004F032D
Also, check the following example, as it provide an example on how to handle strings.
Code Interface Node (CIN) That Converts a LabVIEW String to a C String, Modifies it, and Returns it as a LabVIEW String
http://zone.ni.com/devzone/devzoneweb.nsf/opendoc?openagent&D978409908EA760D8625683A000B6B6E&cat=2F4F574886553A62862567AC004F032D
Regards;
EV
www.vartortech.com -
How do you pass an array of characters using the DLL functions
I have exported C code into my DLL and I want to know how to pass an array of characters using LabVIEW.
Mont;
If you want to pass a string from LabVIEW to your dll, and you do NOT change size of the string, you can use a C String pointer (CStr), which is equivalent to (unsigned) char *.
If you do modify size of the string, pass string as a LabVIEW structure (LStrHandle).
The example "Passing a Variety of Data Types from DLL to LabVIEW" is an excellent starting point. Also make sure you check the manual "Using External Code in LabVIEW".
Regards;
Enrique
www.vartortech.com -
I'm having trouble passing an array of integers to a string and vice versa i.e. the array has
element[0] =1
element[1] =0
element[2] =0 but it can hold up to 16 elements
what I want is for this array which holds a binary number represented by ints to be represented as the string "001". Im passing the method an array then I want it to loop the length of the array and store each element as a part of the string. I then want to add the number to another number put it back in an array and return it. If anyone has any help I would appreciate it.
Thanks.public class YourClass {
public static String arrayToString(int[] theArray) {
int lim = theArray.length;
StringBuffer sb = new StringBuffer();
for (int i = 0; i < lim; i++) {
sb.append(String.valueOf(theArray));
return sb.toString();
public static int[] stringToArray(String theString) {
int lim = theString.length();
int[] theArray = new int[lim];
for (int i = 0; i < lim; i++) {
theArray[i] = Integer.parseInt(theString.substring(i, i+1));
return theArray;
public static void main(String[] args) {
int[] theArray = {1,0,0,1,1};
String theString = arrayToString(theArray);
System.out.println(theString);
int[] theArray2 = stringToArray(theString);
System.out.println(arrayToString(theArray2)); -
Array of strings in container won't pass to array of strings in LabVIEW cluster
I'm new to TestStand but am a CLD. I've taken a 3-day custom course that covered most of TestStand Core 1 and some of Core 2. I'm using TestStand 2013 and LabVIEW 2013.
I have a VI that needs an input of a cluster containing, in this order:
1D array of strings named Column_Labels
2D array of doubles named Results_Data
1D array of paths named Graphics_File_Paths
1D array of booleans named Pass_Fail
In TestStand I created a custom data type called Maxim_Results from the VI module tab in the sequence. When I reference a local (MINSYS_Reuslts) that is made from this Type I get the following error:
No corresponding subproperty in argument 'Locals.MINSYS_Results' of type 'Maxim_Results' for cluster element 'Maxim_Results.Column_Labels'
If, however, I reference each container element to each cluster element separatley there is no error:
Can anyone help me understand why this is happening?
Kelly Bersch
Certified LabVIEW Developer
Kudos are always welcome
Solved!
Go to Solution.Hey Kelly,
I just set up the situation you described, and it worked properly for me. However, I did notice that in your example where you referenced each element individually, your Column_Labels element is actually called "Column_Lables". If this was also misspelled in the LabVIEW Cluster Passing setting for the custom type, it would cause the behavior you're seeing. Could this possibly be the case?
Daniel E.
TestStand Product Support Engineer
National Instruments -
How can i pass the PROPERTY_FALSE as string
Hi,
How can i pass the PROPERTY_FALSE & PROPERTY_TRUE as string to
Set_Item_Property('MY_BLOCK.MY_ITEM',ENABLED,PROPERTY_FALSE);
my requirement is to write a procedure like enable_fields(P_PROERTY_VALUE ..) that enable or disable many items based on the value that i pass.
Set_Item_Property('MY_BLOCK.MY_ITEM',ENABLED,P_PROERTY_VALUE );
Thanks in advance.Infact , property_false and property_true are not strings, They are constants with values 5 and 4 respectively.
So where ever you want to have property_false, pass 5
and property_true , pass 4
But usually we dont follow this method , as the value of the constants may vary from version to version.
So in your procedure say, pass 1 for enable and 2 for disable
procedure (................, p_property number) is
m_set_enable number ;
Begin
If p_property = 1 then
m_Set_enable := property_true;
else
m_Set_enable := property_false;
end if;
set_item_property('item1',enabled,m_set_enable);
End;Edited by: Dora on Dec 29, 2009 2:36 PM -
How do I pass an array to a method?
Hopefully you guys don't mind answering one of my stupid questions :o(
I have problem passing an array to a method.
//Here is the code that calls to the method:
String[] Folder = new String[19];
int cnt;
for(cnt=0; cnt<20; cnt++){
Folder[cnt] = request.getParameter("searchfolder_name" + (cnt + 1));
ProcessNotify(Folder[cnt]);
//================================================================
//Here the the method that is supposed to take in the array
private void ProcessNotify(String FolderName[]){
FolderName = new String[19];
int cnt;
for(cnt=0; cnt<20; cnt++){
System.out.println("Folder Name: " + FolderName[cnt]);
I got an error that says java.lang.String[] can not be applied to java.lang.String
I thought "String FolderName[]" is an array? Anyway... I'm confused. If you know the answer, plz let me know :o) big thx
lilProcessNotify(Folder[cnt]);
Are you trying to pass the whole array or just one piece from it? What you coded, tried to pass just one piece by specifying a subscript. BTW variable cnt is a subscript out of range.
If you meant to pass the whole array, just use it's name with no subscript. -
How do I write an array of strings to a single Excel row?
I'd like to write test data, as an array of strings, to an Excel file. Attached is my attempt to modify one of the Labview 6.1 example files. This modified example will write the data to the correct row, which is determined by serial # of the UUT, but to a new sheet for each unit. I'd like to do the same thing, but to just one sheet. This sheet's data would then be saved after 50 rows of collected test data.
Thank you in advance,
Tim Denson
Attachments:
Write Table To XL.vi 58 KBSorry I didn't get back to faster on this. I've been out of town working and just really haven't had time.
Yes,
The Report Generation toolkit would make this very easy. If you have it, I'd suggest using it.
The image shown below shows the five VIs from the toolkit that I've used to write to Excel.
What this loop does is receive a string through a Queue, either open a
template or open todays file, convert the tab delimited string to an
array, write the array to the next line of the Excel file, Save (with
todays date stamp if opened from the tempate) and close it. It's a good
idea to always save and close teh file after each write if it's not
being continuously written to. In this case, a new line will be written
only once a minute or so. This lessens the chance of losing data if the
machine locks up for some reason. Opening and closing does take time
and can slow down a loop that needs to run at a certain rate. This loop
actually runs in a background process and several other processes send
data to it through the queue to be written. The queue can buffer
several data streams if needed so you won't lose data if it's busy and
you don't have to worry about two processes accessing the Excel sheet
at the same time.
Ed
Message Edited by Ed Dickens on 02-18-2006 11:12 AM
Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
Attachments:
RGTK Array to Excel.gif 14 KB -
How can I resize an array of strings?
I'm having a problem of not being able to use the CIN functions and therefore can't use the convenient resizing methods. I have tried to use NumericArrayResize to resize an array of strings, but it's not working correctly. Here's what I've tried most recently. I have tried many variations, so if you want to modify what I have posted, or just provide new code, please feel free.
typedef struct {
int32 dimSize;
LStrHandle elt[1];
} LStrHandleArray;
typedef LStrHandleArray **LStrHandleArrayHandle;
void someMethod(LStrHandleArrayHandle arrayOut) {
// attempting to write the string "asdf" in the first element in the array. (1D array)
int newSize = 1;
MgErr e = NumericArrayResize(uL, 1L, (UHandle*)&arr
ayOut, newSize);
(*arrayOut)->dimSize = newSize;
LStrHandle hdl = *(*arrayOut)->elt;
long str_size = strlen("asdf");
MgErr err = NumericArrayResize(uB, 1L,(UHandle *)&hdl, str_size);
LStrLen(*hdl) = str_size;
MoveBlock("asdf", LStrBuf(*hdl), str_size);
The code above doesn't result in crashing labview at any time. The string "asdf" is not copied though. And, after being able to copy one string I would like to extend this to many elements in a 1D array of strings.
Thanks!
NaveenLabVIEW stores string arrays as an array of handles to those strings. To resize an array of strings you need to declare a new string in LabVIEW's data space, resize the handle array, and add a handle to your new string. Here is an example program which does this.
-Aaron Marks
National Instruments
Attachments:
resize.zip 252 KB -
How can i combine an array of string and an array of integers ?
i have an array of string data [to be used as header], and an array of multiple column integer vakues;i need them together in one file.
Am not able to combine them so that i can write them into a single file.
Solved!
Go to Solution.
Attachments:
string file input.txt 1 KB
Test build_1.vi 13 KBThere are a few ways you can do this. What I recommend is:
Open the file
Use the Array to Spreadsheet String to turn your headers into a single string
Write this to the file.
Use the Array to Spreadsheet String to turn your numeric data into a single string
Write this to the file.
Close the file
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
Maybe you are looking for
-
I purchased a game on my ipod touch. I restored the device to factory settings last night and when I synced all the apps back, the game is now in the demo version. How do I unlock it ? I hope I don't need to pay for the full version again.
-
How to stop OAFpage auto refresh
Hi all, I have used page refresh code in PR of controller. String onLoadFunction = "\n function onLoadFunction (refTime){ " + "\n setTimeout(\"location.reload(true);\",refTime);" + "\n } " ; oapagecontext.putJavaScriptFunction("onLoadFunction",onLoad
-
Aperture processing images from new Canon 5D mark II
Hi, I'm wondering if anyone has attempted to process images from the new 5D mark II with aperture. It's my understanding that aperture cannot process the images as of yet. Also, does anyone know if there is or if there will be a plug in available for
-
I'm working on a test Mac/Cocoa app. I am editing MainMenu.xib. Immediately after creating a new project, I resize the window and Run. The window is the proper size during the run. But then I stop the run, resize the window in the editor, and then wh
-
[Solved] 'Best' way to install programs?
I was wondering what the arch Linux community thought the best way to install things is. I was wondering if compiling things from source would be better in some cases then using Pacman, I'm sure I read that you prefer people to install from source, w