How to use an array of references
Hi,
I defined a couple of GOOP objects, each of which has a reference. I want to dynamically add/remove these references into/from an array and, in my implementaion, I had this array a globle variable so that different VI's can access it.
But I always got a "refnum conflict" error when I tried to insert a new reference into the array.
Why? Thank you.
-Jianchu
Thanks, Jim.
I am working on some plug-and-play medical instrumentation prototyping. Two GOOP objects (ECG,PO) are developed. In my LabVIEW code, I need to open/close these two objects when corresponding devices connected to/disconnected from the computer.
I want to build a reference array which I can use to operate (primary data storage) the appropriate object.
I browsed your webpage "Object Oriented Design methods in LabVIEW " on OpenG.org. I guess my problem is related to the so-called "Datalog File Refnum Shell", but I don't have an exact idea.
I attached the two GOOP files and a test fie showing the wiring error.
Your help is highly appreciated.
-Jianchu
Attachments:
test_refnum.vi 23 KB
ECG.llb 393 KB
PulseOx.llb 367 KB
Similar Messages
-
How to use OracleDbType.Array provided by ODP with User defined type ?
Can anyone help me how to use OracleDbType.Array provided by ODP.NET ?
I need to pass string array to a oracle stored procedure .
User defined array type defined in oracle is :
CREATE TYPE TYPE_NAME IS TABLE OF varchar2(20) ;
This type is defined outside of any package , and i have tested that if definition of type is modified to
CREATE TYPE TYPE_NAME IS TABLE OF varchar2(20) index by binary_integer , i am able to pass array as AssociativeArray to my Stored Procedure.
But how to pass array object if the Type's definition does not contain index by clause ?
Please help how to pass Array object to Oracle Stored Procedure ?The solution described in Passing Array of UDT or Collection as IN OUT using OracleDbType.InputOutput
is working for me.
Edited by: stzueger on Jan 2, 2012 10:32 AM -
How to use Javascript array in the JSP
hELLO Friends,
I am creating an String array using the values
in the list of a jsp page using Java script..
How can I use this array in the same jsp
file for processing...
any help in this regard would be highly appreciated.
thanks in Advance...
ashishyou cannot pass values from javascript to JSP without having to form-post to another JSP page.
-
Hi, i'm trying to automate a questionary using array.
// In the compositionReady for the stage
sym.actual = 0;
sym.arr = [ "Hi","Love","You" ] // This is my question array.
sym.checkArr = function(){ // this the function that i use to check whis question of the array i'm going to use.
sym.Question = arr[actual]; // i want to use the value "Hi", and then increase my "actual" var and then use the value "Love"
// In my symbol timeline i use a trigger, in that trigger i use
sym.stop();
sym.quest = sym.getComposition().getStage().Question; // I'm getting the Question value;
sym.$("Ask").html(quest ); //"Ask" is an empty textfield;
sym.getComposition().getStage().actual ++; // Increase "actual" for the nex time.
But the code doesn't work, i think the problem is the way i use the array index.
Please help!
Thanks =)Hi there,
chino_10 wrote:
in te timeline trigger why did you use a local variable?
It's good practice to use local variables whenever possible. The quest variable will only apply to that trigger, and it won't carry over to another trigger in the same timeline. So when using a trigger to set the HTML of a text element in the same timeline, I find it cleaner to assign a new HTML value from a local variable.
chino_10 wrote:
and if you are calling the global variable "actual" from de compositionReady handler why didn'y you call it with all the path like "sym.getComposition().getStage().actual ++;"?
I think maybe I didn't express it as clearly as I could have. When you declare sym.actual in compositionReady, you actually have declared a variable scoped to the main stage symbol - it's not a global variable. To declare a global variable (which is not always best practice), your code in compositionReady would be:
actual = 0;
This actual variable would now be accessible from any element/symbol in the composition simply by assigning a value to actual. You may see how this could quickly get messy.
So getting back to variable scope: if you declare a symbol variable using sym.varName, then any element in the same scope can call it using sym.varName. So your main timeline triggers can call it without using the full addressing of sym.getComposition().getStage().actual++. Instead, you could just use sym.actual++. Less code, and easier to read. But if you wanted to call it from another symbol (outside of the scope of the main stage), then you'd have to use the full addressing to actually address the variable, i.e., sym.getComposition().getStage().actual ++.
hth,
Joe -
Morning all,
I am trying to setup an array of numbers however, by looking at the crystal reports help file, I cannot find out how to set one up.
I have created a new formula and inserted
Local NumberVar Array x := MakeArray (1, 2, 3, 4, 5);
however, it says you cannot set a result to an array.
I have also looked at the Array help, but Crystal shows a VB syntax instead of Crystal. (How helpful to show VB syntax in CR!)
My question is how can you use an array in your report that it shows numbers 1-5?
many thanks
Kind Regards
JehanzebThe question is - what you want to do with this array. Your code is correct , beside that you need to return something from formula and that needs to be discrete value.
Local NumberVar Array x := MakeArray (1, 2, 3, 4, 5);
"test" -
Hello,
I have a cluster of checkboxes and I want them to be exclusive an to change the visible objects of my vi when I change their state. To keep my code clear I decided to create a subvi that implements this functionality. My subvi recives an array of references to the objects from which I want to change the visibility, an array of references to the checkboxes (to be able change it's values to make them exclusive when one of the checkboxes change it's state), and an array of the values of the checkboxes in the last iteration (to be able to detect which one has change to true and set to false the other ones).
The problem that I have is that when I use a property node to get the actual values of the checkboxes in the subvi (to compare them to their previus state and detect changes) I obtain a variant type and not a boolean. I've tried to set the mechanical action of the booleans references used as input in the subvi as switch but this doesn't seem to work. I understand that is cause the subvi can't know type of booleans that will recieve and asume the worst case....
Is there a way to do what I want?
I hope I've explained myself... Thanks in advance!
Solved!
Go to Solution.There are a few ways to deal with this, but it would help to see your code. Are you sending a reference of the Cluster into a VI, or individual references of the checkboxes? It sound like you are not using a strict reference. The workaround, since you know the datatype, is to use Variant to Data and change the variant to a boolean, but this shouldn't be necessary. Again, post some code so we can be more help.
edit: It sounds like you are trying to hard code Radio Buttons. You do know that LabVIEW has Radio Buttons now, right?
Richard -
How to use an array in a SQL Query
Hi
I need to use an array of numbers such as a VARRAY or Associated Index Array so that I can do the following SQL:
select *
from *
where array is null or id is in array
So that if the array is empty it will return all the records, and if the array is not empty then it will return only the rows associated with the ids in the array.
Is this possible?
Regards,
Néstor BoscánActually, solution I posted returns all rows when VARRAY is empty, not when it is null. To return all rows when VARRAY is null, use:
SQL> select ename
2 from emp
3 where deptno in (select * from table(cast(sys.OdciNumberList(10,30) as sys.OdciNumberList)))
4 or sys.OdciNumberList(10,30) is null
5 /
ENAME
ALLEN
WARD
MARTIN
BLAKE
CLARK
KING
TURNER
JAMES
MILLER
9 rows selected.
SQL> select ename
2 from emp
3 where deptno in (select * from table(cast(null as sys.OdciNumberList)))
4 or null is null
5 /
ENAME
SMITH
ALLEN
WARD
JONES
MARTIN
BLAKE
CLARK
SCOTT
KING
TURNER
ADAMS
ENAME
JAMES
FORD
MILLER
14 rows selected.
SQL> SY. -
How to use Associative Array in sql query?
Hello,
I have a problem on using Associative Array variable on query; and my query is similar to the one below;
TYPE OTHERGENERICS IS TABLE OF NUMBER(10) INDEX BY BINARY_INTEGER;
othersGenerics OTHERGENERICS;
CURSOR cursor_othersGenerics IS
select master.GENERICCODEID
from ASMTRG_ARTICLEMASTER master
join ASMTRG_ARTICLEMAP map on MAP.ARTICLECODEID = MASTER.ID
group by MASTER.GENERICCODEID
minus
select FGG.GENERICCODEID
from asmtrg_icfocusgroup fg
join asmtrg_icfocusgrpchannel fgc on FGC.GROUPID = FG.ID and fgc.isactive=1
join asmtrg_icfocusgengroup fgg on FGG.GROUPID = FG.ID and FGg.ISACTIVE=1
where fgc.channelid=1 and fg.isactive = 1
group by FGG.GENERICCODEID;
BEGIN
OPEN cursor_othersGenerics;
FETCH cursor_othersGenerics BULK COLLECT INTO othersGenerics;
CLOSE cursor_othersGenerics;
SELECT icfrd.*,
CASE
WHEN EXISTS(select ta.genericcodeid from <???XXX???> ta where ta.genericcodeid = icfgrp.genericcodeid) THEN -1
ELSE icfrd.icfgroupid
END CLASSIFICATION
FROM ASMTRGVIW_ICFOCUSREPORTDATA icfrd
LEFT JOIN ASMTRG_ICFOCUSGROUP icfgrp on icfrd.ICFGROUPID = icfgrp.ID
WHERE (channelId IS NULL OR icfrd.CHANNELID = channelId)
AND (asmCodeId IS NULL OR icfrd.ASMCODEID = asmCodeId)
AND (yearId IS NULL OR icfrd.YEARID = yearId)
AND (monthId IS NULL OR icfrd.MONTHID = monthId)
END;
By the way this is a part of my function.
The "othersGenerics" is my associative array variable and <???XXX???> is the place where I need to use my "othersGenerics" array to check. So far I've tried
"select ta.genericcodeid from table(cast(otherGenerics as OTHERGENERICS)) ta where ta.genericcodeid = icfgrp.genericcodeid",
"select ta.genericcodeid from table(otherGenerics) ta where ta.genericcodeid = icfgrp.genericcodeid",
"select ta.genericcodeid from otherGenerics ta where ta.genericcodeid = icfgrp.genericcodeid"
and these are not working.
What is your suggestions?Your type will have to be created as an independent object in your schema. So CREATE TYPE cannot be in your function declaration, it has to be outside it. (And then the line inside your declaration that defines the type will have to be removed.)
But now I can see that you use this array as a kind of "temporary lookup table" - you populate the array and then use it for lookup in your select statement. An alternative way of doing this could be like this completely without arrays:
with othergenerics as (
select master.GENERICCODEID
from ASMTRG_ARTICLEMASTER master
join ASMTRG_ARTICLEMAP map on MAP.ARTICLECODEID = MASTER.ID
group by MASTER.GENERICCODEID
minus
select FGG.GENERICCODEID
from asmtrg_icfocusgroup fg
join asmtrg_icfocusgrpchannel fgc on FGC.GROUPID = FG.ID and fgc.isactive=1
join asmtrg_icfocusgengroup fgg on FGG.GROUPID = FG.ID and FGg.ISACTIVE=1
where fgc.channelid=1 and fg.isactive = 1
group by FGG.GENERICCODEID
SELECT icfrd.*,
CASE
WHEN EXISTS(select ta.genericcodeid from othergenerics ta where ta.genericcodeid = icfgrp.genericcodeid) THEN -1
ELSE icfrd.icfgroupid
END CLASSIFICATION
FROM ASMTRGVIW_ICFOCUSREPORTDATA icfrd
LEFT JOIN ASMTRG_ICFOCUSGROUP icfgrp on icfrd.ICFGROUPID = icfgrp.ID
WHERE (channelId IS NULL OR icfrd.CHANNELID = channelId)
AND (asmCodeId IS NULL OR icfrd.ASMCODEID = asmCodeId)
AND (yearId IS NULL OR icfrd.YEARID = yearId)
AND (monthId IS NULL OR icfrd.MONTHID = monthId)
...The with clause (subquery factoring) you can think of as a kind of temp table called othergenerics created "on-the-fly".
The optimizer may decide to actually create a temp table for you and use in the lookup, or it may decide to rewrite the query into suitable joins or nested loops or hashing - whatever the optimizer decides will be the optimal way of doing things :-)
So unless you use your array other places in your function, I would recommend dropping the array completely, skip populating an array, and instead use a with clause for your temporary lookup. -
How I use an array in class2 if I create it in class1
I have 2 class
class1
create array1
class2
how I use the array1public class Class11 {
public static void main(String[] args) {
char[] c = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h' };
Class22 c2 = new Class22(c);
class Class22 {
char[] c;
Class22(char[] p) {
c = new char[p.length];
System.arraycopy(p, 0, c, 0, p.length);
}Mark -
I am giving the input below shows
<to>
<email>[email protected]</email>
<email>[email protected]</email>
</to>
i will put the while loop and i count the index values.
in while loop,it takes only one email id.
my coding is
<while condilition=('varindex'<ora:countnodes('inputvariable','payload',/client:to))>
<assign activity>
<first copy rule>
<vartemp= concat('vartemp',"",bpws:getvariabledata('email'))>
<second copy rule>
<varindex = vraindex+1>
</assign>
</while>
but vartemp adds only 1st email id.if i pass <vartemp= concat('vartemp',"",bpws:getvariabledata('email[varindex]'))> ,It shows error.
pls how to retrieve the two email ids using array index.
Edited by: user8984400 on Jan 13, 2010 11:22 PMhave you tried this :
http://clemensblog.blogspot.com/2006/03/bpel-looping-over-arrays-collections.html
or this :
http://oraclebpelindepth.blogspot.com/2008/09/arrays-in-bpel_21.html
your assign should be something like :
before this assign outside the loop you can assign the counter_index to some variable by ora:countnodes('inputvariable','payload',/client:to), and use this variable in the other xpaths
<from expression="concat('/ns1:to/ns2:mail[',bpws:getVariableData('Variable_Index_Counter'),']') "/>
<to variable="Variable_Xpath"/>
notice also the [] characters, you need those together with the index-value to be able to loop over the list of email-elements
hope its clear? -
How to use an array for variable name of swing components using NetBeans
I'm completely new to Java and GUIs, so excuse me if I use the wrong terminology. I'm making a JFrameFrom in NetBeans. I'm getting really tired of typing instructions like jTextField15.setText(variable[15].text); I would like to make the variable names of my text fields an array so I can use a loop to change the values, text, tooltips, etc. When I click "change variable name" it won't let me put an array in. The code that Swing generates is protected and I can't change it. I know there must be a way to do this. Any help is appreciated.
Try not to use the NetBeans visual GUI builder. Then it should be easy to create an array of text fields:
JTextField[] tfs = new JTextField[15];
for (int i = 0; i < tfs.length; i++) {
tfs[i] = new JTextField(10);
}For laying out the text fields, see: [http://download.oracle.com/javase/tutorial/uiswing/layout/using.html] -
I want to link nine arrays whose dimension is 2*2 horizontally,but the function 'build array' (concatenated way) made them vertically.........help me please..........maybe this is too simple.........since I am only a students who learnd labview only few months..
Solved!
Go to Solution.A transpose operation only solves certain scenarios, but you don't give enough information on what you actually want.
For example, of you have 3 2x2 arrays:
a1 a2 b1 b2 c1 c2
a3 a4 b3 b4 c3 c4
What should the final vertical result be?
a1 a2
a3 a4
b1 b2
b3 b4
c1 c2
c3 c4
or
a1 a3
a2 a4
b1 b3
b2 b4
c1 c3
c2 c4
Or something else?
Please be much more specific. Maybe even attach a small VI containing typical default data.
LabVIEW Champion . Do more with less code and in less time . -
How to Use SOAPArray to Exchanged Data with a Web Service
The method of a prototype Web service I created is defined to take many parameters
and return an object of a user defined class. Furthermore, the user defined class
includes data elements of another user defined class and the Java ArrayList class.
This works with a Java client referencing the WebLogic created client.jar file
but I don't know how well it will work with a non-Java client. In particular,
with Perl which is the language that will be used by the developer who first will
test with the prototype.
In posts to this newsgroup use of "language-specific, generic containers" has
been discouraged and the "language-agnostic" SOAPArray recommended. I have searched
this newgsroup and the Web for examples of how to use a SOAPArray in a Web service
EJB to receive parameters and return results but found none.
Will someone refer me to an example or give an overview of how a Java Web service
EJB running in WebLogic 6.1 would use SOAPArray to get parameter values and return
results?
Also, I would like confirmation that it is best to use SOAPArray to exchange data
with a Web service to achieve the goal of a service accessible by any language.
Thank you.Replies in-line:
How are the structures, e.g. gltrans-workType, defined in the Web service?The structure is made up of nested Java Beans, but this does not mean that the
client for your web service has to be written in Java. The WSDL that I sent contains
everything that a .NET-based (or Perl-based, or Python-based, or VB-based, or
C++ based) Web Service Stack needs to correctly create all the data types in the
web services' signature! That's the beauty of XML Schema! It's programming language
independent :-)
In
other words, what definition in Java resulted in the WSDL statements?The WSDL wasn't produced by WLS 6.1, but it (WLS 6.1) can consume it.
What is the signature of method submitGLTransWorkAsJavaBean() in the
Web service?public void submitGLTransWorkAsJavaBean(GlTransactionsCpyType glTransactionsCpyType)
GlTransactionsCpyType is the outer-most Java Bean. WLS 6.1 does not generate
Java Beans for you, but it will use ones that you defined. See the Java Bean tutorial
on the Javasoft sitem for details on how to create a Java Bean.
Was the WSDL generated using the WL tools for creating a Web service?No.
Conclusion:
You asked for someone to provide you with an example of how to use SOAP array
in a WSDL, which is what the attached file contained :-) What you want to do now
is find a tool that can generate Java Bean code from this WSDL (Apache Axis has
a wsdl2java tool that should work), or create the Java Beans yourself. Afterwards,
create a WLS 6.1 Web Service a expose it for a Perl or .NET client.
Regards,
Mike Wooten
"Jeff Carey" <[email protected]> wrote:
>
Please elaborate.
How are the structures, e.g. gltrans-workType, defined in the Web service?
In
other words, what definition in Java resulted in the WSDL statements?
What is the signature of method submitGLTransWorkAsJavaBean() in the
Web service?
Was the WSDL generated using the WL tools for creating a Web service?
Thank you.
"Michael Wooten" <[email protected]> wrote:
Hi Jeff,
Sounds like a pretty cool prototype :-)
I have attached a WSDL (at the bottom of this post) that contains a<schema>
that
uses a SOAPArray to create an array of a <complexType>.
HTH,
Mike Wooten
"Jeff Carey" <[email protected]> wrote:
The method of a prototype Web service I created is defined to take
many
parameters
and return an object of a user defined class. Furthermore, the user
defined class
includes data elements of another user defined class and the Java ArrayList
class.
This works with a Java client referencing the WebLogic created client.jar
file
but I don't know how well it will work with a non-Java client. Inparticular,
with Perl which is the language that will be used by the developerwho
first will
test with the prototype.
In posts to this newsgroup use of "language-specific, generic containers"
has
been discouraged and the "language-agnostic" SOAPArray recommended.
I have searched
this newgsroup and the Web for examples of how to use a SOAPArray in
a Web service
EJB to receive parameters and return results but found none.
Will someone refer me to an example or give an overview of how a Java
Web service
EJB running in WebLogic 6.1 would use SOAPArray to get parameter values
and return
results?
Also, I would like confirmation that it is best to use SOAPArray toexchange
data
with a Web service to achieve the goal of a service accessible by any
language.
Thank you. -
Using two arrays to hold x,y coordinates
Hi, all
Does any1 know how to use 2 arrays to hold x,y coordinates of five rectangles all of which are 30 by 40 pixels in size?Your homework assignment probably meant to use a 2-dimensional array, not to create two separate arrays.
Like this:
int rectangles[][] = new int[100][100]; -
Do You Use the TestStand API Reference Poster?
The TestStand R&D Team would like to know how you use the TestStand API Reference Poster that ships with TestStand. How often do you use it? Is it hanging up near your computer? What tasks do you use it for?
Allen P.
NIHi,
I dont use the hard copy. I unfolded the it the first time it appeared in version 3.0. Refolded it, put it back in the box and have never bothered with it since.
I have used the electronic version now again, when I haven't got access to the programmer help doc which you find in the teststand\bin folder.
I find its use limited, as it only really gives you the relationship between classes and a list of the properties and methods. This you can obtain for the help document.
Regards
Ray Farmer
Regards
Ray Farmer
Maybe you are looking for
-
Apps not showing up in privacy setting
I have an iphone 4s i downloaded apps such as dropbox and viber a need to turn on the privacy settings. However these apps are not recognised by the phone as when i go into privacy dropbox and viber are nowhere to be seen.
-
Suddenly I can no longer find my youtube app icon. If I search my ipod it does show up and I can open it. If I go into the App Store it shows under purchased and I can also open it from there. But the icon is missing from my home screen. I looked in
-
Printing by computer via internet
I have HP deskjet ink advantage 3545. I use my company laptop, it can't be installed any programs and drivers. I have a problem with printing my work document so I want to ask you " how can I print my document by my laptop via internet ". My printer
-
Hi, Anyone know of any way to dynamically set the endpoint URI property of an ALSB business service from the payload ? Hanx!
-
CAn any body explain me what is DEVLINE.................. because im getting error.......in integration directory......... <b>DEVLINE does not exist.....?</b> i cant do anything in ID............... when i m trying to create business sysytem,communic