LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Identify if the subvi is called for the first time by a second top-level VI

Solved!
Go to solution

I need to execute a section of the code only when a particular subvi is called for the first time by a second top-level caller. Now the obvious problem with using the 'first call?' function is that identifies the first call since the start of the top-level VI. 

 

Is there a way to identify the first calls since the start of the second top-level vi. As my second top-level vi has to open and close multiple times

0 Kudos
Message 1 of 21
(2,358 Views)

Use Some Variable (Boolean) By Default Let it be True  which executes Sub VI For the First time after which make the Boolean False and For Next time you bypass the Case by using Boolean Variable.

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 2 of 21
(2,333 Views)

I wanted to do that for multiple VIs, therefore was looking for subvi routine that is equivalent to "first call?" function but it returns true whenever the second top-level VI call a particular subvi for the first time.

0 Kudos
Message 3 of 21
(2,312 Views)

Put the first call primitive into the top level VI and pass it into the subVI through the connector panel.

Message 4 of 21
(2,299 Views)

Sorry I didn't understand that.

 

To reiterate my requirement

- I have a top-level VI 'A', which calls a second top-level VI 'B'.

- B further calls 'C', 'D' and 'E'. 

- If I use a first call function in C, D, E, it would return true in the respective only once until A is running no matter how many times B opens and closes.

- What I need was that every time B closes and opens again and calls C, D, E for the first time I need a flag that sets high. 

0 Kudos
Message 5 of 21
(2,284 Views)

Don't put the first call in the subVI's.

 

Put a boolean control in those subVI's that shows up on the connector panel.

 

Put the first call in the top level VI and pass that into the subV's through the connector panels.

 

What you've described in this message seems to be a little bit more complicated than the original message.  You only described one level of subVI's before.  Now you are describing two levels.  But the principle is the same.  Let the higher level VI's tell the subVI's when they are being called for the first time.

0 Kudos
Message 6 of 21
(2,274 Views)

@Rex_saint wrote:

Sorry I didn't understand that.

 

To reiterate my requirement

- I have a top-level VI 'A', which calls a second top-level VI 'B'.

- B further calls 'C', 'D' and 'E'. 

- If I use a first call function in C, D, E, it would return true in the respective only once until A is running no matter how many times B opens and closes.

- What I need was that every time B closes and opens again and calls C, D, E for the first time I need a flag that sets high. 


  • How does A call B?
  • What else calls C, D or E? (except B)
  • Does B call these VIs (C,D,E) multiple times? Is that why you want to know which is the "first" repeated call?

GCentral
0 Kudos
Message 7 of 21
(2,258 Views)

@cbutcher wrote:

@Rex_saint wrote:

Sorry I didn't understand that.

 

To reiterate my requirement

- I have a top-level VI 'A', which calls a second top-level VI 'B'.

- B further calls 'C', 'D' and 'E'. 

- If I use a first call function in C, D, E, it would return true in the respective only once until A is running no matter how many times B opens and closes.

- What I need was that every time B closes and opens again and calls C, D, E for the first time I need a flag that sets high. 


  • How does A call B?
  • What else calls C, D or E? (except B)
  • Does B call these VIs (C,D,E) multiple times? Is that why you want to know which is the "first" repeated call?

A calls B multiple times and I control with a boolean logic when the calling of B should happen

 

C, D and E are only called by B

 

Yes B calls C D E multiple times before it closes. And yes that is why i wanted to know which is the first repeated call, i.e (first call) for time the B is called by A

0 Kudos
Message 8 of 21
(2,255 Views)

@RavensFan wrote:

Don't put the first call in the subVI's.

 

Put a boolean control in those subVI's that shows up on the connector panel.

 

Put the first call in the top level VI and pass that into the subV's through the connector panels.

 

What you've described in this message seems to be a little bit more complicated than the original message.  You only described one level of subVI's before.  Now you are describing two levels.  But the principle is the same.  Let the higher level VI's tell the subVI's when they are being called for the first time.


If I make a small demonstration code and post here would you please help me implement this modification you suggested. Maybe I am still not being able to convey what I wanted properly or failing to see how your suggestion suits what I require

0 Kudos
Message 9 of 21
(2,252 Views)

@Rex_saint wrote:

A calls B multiple times and I control with a boolean logic when the calling of B should happen

C, D and E are only called by B

Yes B calls C D E multiple times before it closes. And yes that is why i wanted to know which is the first repeated call, i.e (first call) for time the B is called by A


Then the logic described by RavensFan will work perfectly here: during the execution of B, you know which is the first call of each of C, D and E.

You can add a boolean to the connector pane of those 3 VIs, and specify their value in B's block diagram.

B.png

 

Here you see a dummy example that calls D twice (true the first time, false after) and C repeatedly (true the first time, false after).

Of course, this doesn't run, but hopefully it demonstrates the idea.

 


GCentral
0 Kudos
Message 10 of 21
(2,248 Views)