LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

function global shift registers

Hi all,

 

I have a functional global that has multiple function.  I can create a file and store the reference in a shift register, open that file and append to it, close the file, etc. 

 

If I need to create and append for two files, I can't just use that function, since the reference would be lost.  What would be the best way to use functional global to save reference and process multiple files? 

 

Thanks!

 

Yik

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 1 of 6
(2,682 Views)

How about a class rather than a FG?  Just a thought.  Matt

0 Kudos
Message 2 of 6
(2,672 Views)

Make your FG (this is really an "Action Engine" since it does work, not just store data) hold an array or cluster of filenames (or references) in it's shift register.  You'll have to set up a way to tell the AE which file to act upon of course.

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019 - Unfortunately now moving back to C#, .NET, Python due to forced change to subscription model by NI. 8^{
0 Kudos
Message 3 of 6
(2,667 Views)

@jyang72211 wrote:

Hi all,

 

I have a functional global that has multiple function.  I can create a file and store the reference in a shift register, open that file and append to it, close the file, etc. 

 

If I need to create and append for two files, I can't just use that function, since the reference would be lost.  What would be the best way to use functional global to save reference and process multiple files? 

 

Thanks!

 

Yik


It really depends on how you want to control which of the files get acted on. You could duplicate all of the code for another and add actions unique to thta file or you could keep an array of file refs internally and use a "reference" to control which file you are working on at that call. But if you are going to pass a ref around, it might just as well be a ref to a LVOOP class and that's where mtat's reply comes into play.. but that is hardly an Action Engine answer.

 

So please tell how the new file compares with the other and to what extent you see this growing in the future.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 4 of 6
(2,664 Views)

Please show me an example of how to do this in LVOOP, which I have never tried up to this point.  The action engine is not expected to grow much in the future.  It is just a place to save file referenece and to perform file operation for multiple files.  Thanks!

 

Yik

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 5 of 6
(2,646 Views)

Here is an example of a very basic class that manipulates files - how it might be implemented would be up to you.  I have given an example of what you might do called Implementation.vi (it uses a data value reference which forces you to reference that portion of memory every time you wish to manipulate those values but prevents the need for a shift register and allows interloop communication without any queues or notifiers).  I apologize for the crudeness, but my time might be better spent prettying up my own code Smiley Very Happy.

 

Cheers, Matt

0 Kudos
Message 6 of 6
(2,634 Views)