Initialize the shared variable

"From the issue description it seems that the Shared variable needs to be reinitialize.
Create a formula to initialize the shared variable value and place it in appropriate section of the Main Report based on the section in which you are displaying shared variable value of the Subreport."  (post from Poonam Thorat 7/7/08)
This is a solution to my problem.  However, I'm not sure how to initialize the shared variable value nor do I know where to place it in the appropriate section of the main report.  Therefore, what should the formula look like and where should it go in the main report?
Can anyone help me with this?
Thanks much!

Hello
Lets say you have a report like this
Report Header
Page Header
Details
Report Footer
Page Footer
If you want to create and initialise a shared variable, create a formula like this
For this example call this forumula Rate
whileprintingrecords;
shared numbervar Rate := 1.5; // this can also be a field
If you needed to use this shared variable in the Details section, then you would place the Rate formula in the Report Header, or Page Header (above Details so that it is created before the Details section is created)
In details lets say you have some other calculation - Commission
The Commission formula would look like this
whileprintingrecords;
shared numbervar Rate; // a shared variable must be referenced in each formula that it will be used.  It is NOT being initialised or set to any value here, just referenced
{table.fieldname} * Rate
Place the Commission formula in the Details section and Rate will be for each record in the report
The same process applies for passing values from main report to sub report and vice versa
There is also plenty of info in the Help and online about using shared variables
Best regards
Patrick

Similar Messages

  • Error with the Shared Variable Engine

    Hi,
    I have a problem with the Shared Variable Engine,
    A .doc File is attached to this message, decribing the problem with pictures.
    I will be glad if anyone can help me. 
    Sincerely yours
    Amitai Abramson
    Attachments:
    Question.doc ‏819 KB

    Hi Amitai,
    Good afternoon and I hope your well.
    A member of the team from NI Israel contacted me regarding this post.
    I want to provide you with extra details on how to resolve your issue - i.e. Repair (Or Re-install) the Shared Variable Engine.
    If you use the MsiBlast Tool it will populate a list of all MSI NI Installers. One of these will be NI Variable Engine. On the right-hand side you can the click 'Repair'. I would also Repair the engine support for the versions of LabVIEW you have installed. Please see attachments for MsiBlast and a screenshoot of the MSIBlast screen.
    If this doesn't work I would recommend re-installing LabVIEW using the following guide, which I posted on this forum. (second post by me).
    Please let me know how you get on,
    Kind Regards,
    James.
    Message Edited by Hillman on 12-03-2008 12:19 PM
    Message Edited by Hillman on 12-03-2008 12:19 PM
    Kind Regards
    James Hillman
    Applications Engineer 2008 to 2009 National Instruments UK & Ireland
    Loughborough University UK - 2006 to 2011
    Remember Kudos those who help!
    Attachments:
    Repair Shared Variable Engine.JPG ‏97 KB
    msiBlast.zip ‏110 KB

  • In the shared variable properties box, when enabling aliasing, what is the difference between binding to a project variable vs. to a psp url

    In the shared variable properties box, specifically with regard to a the target being an rt target, when enabling aliasing, what is the difference between binding to a project variable vs. to a psp url?

    The difference is in the type of variable you are binding it to.  A project variable is a variable that lives within the specific project in which it was created.  A PSP URL is an address using the Publish-Subscribe Protocol (PSP).  You can learn more about PSP URLs here: http://zone.ni.com/reference/en-XX/help/371361G-01/lvconcepts/using_datasocket_technology/#Specifyin...
    PSP URLs will enable it to communicate between different machines and also between projects which may or may not be open.  The project variable will exist within the project.
    Julian R.
    Applications Engineer
    National Instruments

  • Where can I find the "Shared Variable Properties" VI to be used in my program for configuring SV remotely?

    I was using the "configure Alarms" and "configure Logging" VIs to design two user interfaces to make use of these VIs when I came across a problem.  In both VIs you can enable logging of alarms.  So which one is valid?  Which one has priority?  Then I looked at the "Shared Variable Properties" built into the project explorer.  Now I realize that I am spending all of this time redesigning this properties dialog (which also has two options of enabling logging of alarms (on the Alarms tab to the far right side as well as on the Logging tab).  So now my question is, how do I access this "Shared Variable Properties" dialog through my program (Note: this would be on a different machine than where the shared variables are set up.  The point is to configure shared variables remotely).
    Thanks
    Matt

    Here is a VI I re-created and posted for all.  I'm not sure why NI doesn't provide their VI to the developer.  The only thing I can't figure out is that when reading in the "Ack Type" into a variable, it generates an error.  It will work if you go into "project explorer" and right click on the library with the shared variable and "deploy" but eventually stops working.  I have tried using the "undeploy library" and "deploy library" to see if this would be a work around but had no success.
    Just pipe the path of the shared variable into the vi.
    Mattk
    Attachments:
    Shared Variable Properties.vi ‏95 KB

  • What causes the Shared Variable Engine to Crash?

    All,
    Some background info:
    I am using the SVE and DSC so that I can log my data to Citadel using Data Sets. I converted a previous DSC 7.1 project that used the tag engine over. That app ran for over 18 months. Need to upgrade app and add features at my customer requests so we migrated to LV 8.0.1.
    I have an app that crashes the Shared Variable Engine (SVE). I created a test app with a single SV and then created a control and bound it to the SV and it works every time until I launch the larger app. The main app only has 33 SV that are set when I receive TCP data from PXI RT system (not using SV on RT since the logged data is only a fraction of the total data streamed and I don't want to take apart the RT data and send the SV separately). I have bound front panels controls to the SV's. When I run, I get server connection has been closed. I verified that the SVE was running with the test app before launching the main app.
    I deploy the shared variables in the application and have verified they are deployed by the Monitor Variables utility ... but it always shows "No Value" for the data fields. I have set logging to enabled for data only, set Value Deaband (%) to 0 and Value resolution to 0, Update Deadband is Disabled as is Alarming, Scaling, Initial Value and Description. Security is set to default. All of the variables are set to Double, Network-Published, Single Writer with Buffering and Bind to Source disabled.
    I have verified that the SV deploy without error by clicking Deploy from the project. Autodeploy All is off but I get the same results with it On (checked).
    I undeploy and kill the process when I close the application.
    I have tried only using 1 or 2 of the SV in the main app but get the same results. Every once in a blue moon it will work after rebooting the PC (but not everytime). Once it dies I have tried running NI examples as well as the test app and they fail until I reboot.
    The error code indicates that the SVE engine has crashed. I have changed the service settings on Windows to relaunch on 1st, 2nd and all times after but nothing restarts the SVE. After it crashes it is impossible to exit LabVIEW without it hanging or reboot the PC without pressing the hard On/Off switch.
    Once it dies there is nothing that I can do to get it back alive without rebooting the PC (a real problem for a control and monitoring system).
    Any ideas would be greatly appreciated
    Thanks.
    Randy

    Randy
    Sorry for the delay, I've been researching your issue and juggling a few other issues. :-)  One thing we can check is the Windows Event Log which will give us some more details as to WHY the Shared Variable engine seems to be blowing up on us (Conttrol Panel -> Administrative Tools -> Event Viewer).  Any details in there along the lines of Variable Engine or Tagger crashing will help us narrow down what's going on.
    There's always a possibility of files not getting upgraded correctly; however there aren't many shared components between LV 7.1 and LV 8.0. The Shared Variable engine is entirely new and the installations of LabVIEW themselves don't share many files outside of the example finder and a few other small common components (things located in the appropriately named Shared folder)  I keep both on my machine (in addition to 5.1, 6.1, 7.0, and 8.2) without any hiccups.
    The SVE crashing I have seen in the past (and from internal bug reports) has been from buggered installs, so uninstalling and reinstalling DSC may be a good course of action. One good test to do in the middle is to see if the engine still crashes with DSC uninstalled. 
    Hope this helps.
    --Paul Mandeltort
    Automotive and Industrial Communications Product Marketing

  • Appear to lose connection with the Shared Variable Engine

    Have been through the boards, but with no success regarding the specifics of my problem.
    I am running a real-time application on a PXI-8108.  The host software is taking care of user interface, etc.  Information exchange is handled using Unbound Network Shared Variables (located on the host, though problems occur no matter where the variables are located).  Everything deploys fine.  Software runs swimmingly.  I have backed off the DAQ/communication processes until the RT cores are at <10% busy.  However, occassionally while running, I get a popup "Waiting for Real-Time Target xxx to respond..."  If this message stays up for long enough, then the target's attempts to read the Shared Variables start erroring out with an error -1950679035.  As the variables have already been deployed and used prior to this instant, I find this curious.  If I filter out the error, eventually the real-time software comes back up and everything progresses as though nothing happened.  However, this is a potential deal-breaker for the users who can be impatient with having to wait a few seconds for the software to respond.
    Any idea what is happening?  I'm not pumping huge amounts of data over the network, no threads should be starving.  Kinda confused.
    Dan M. 

    The shared variables are being used much like how a queue would, directing each loop to perform an action should the host require it.  If no action is required, then the loops default to check their respective bus or DAQ.
    Currently, I am running 13 timed loops (whose periods I have extended signficantly during debug to no detrimental effect of my software, but to no improvement in the issue in question):
    RS-232/J1708 converter loop (50ms period)
    CAN loop (50ms)
    DMM loop (250ms)
    Oscilloscope loop (250ms)
    DAQ loop (50ms, includes 1 AI task, 4 DI tasks, and 6 CTR in tasks)
    Switch loop (50ms)
    RS-232 loops (50ms for the main, 1 additional loop at 1Hz)
    RS-485 loops (50ms for the main, 4 additional loops at 1Hz)
    Both cores appear to share the load, usually the aggregate load is under 15%.  When the popup appears telling me that the host is waiting for a reply from the target, the PXI controller monitor output still updates the CPU loads, which do not show anything unusual, such as a spike or a freeze in loading.  The target loading does spike up to about 30% total after the communication is reestablished, but that appears to be the software attempting to "catch up" with the events that occurred during the "black out". 
    The error reads like this:
    Shared Variable in Main Target Application.vi
    This error or warning occurred while reading the following Shared Variable:
    \\My Computer\Host-Target Interface\RS-485 Messages to Target    [<--insert other variables here]
    \\192.168.1.122\Host-Target Interface\RS-485 Messages to Target
    Unable to locate variable in the Shared Variable Engine.  Deployment of this variable may have failed.
    Are there any other drivers that would be starving the Shared Variable Engine?  For example, if a VISA or NI-DAQmx driver goes to sleep, could it hold up the SVE?  What execution system are they running under? 
    Thanks for your help!
    Dan M.

  • LabVIEW could not generate code for the shared variable.You must open the VI in the project that contains the library where the shared variable resides

    HI
    When I put a network shared variable with fifo RT activated on my diagram, the arrow is broken.and I' ve got this message:
    ""LabVIEW could not generate code for the shared variable.You must open the VI in the project that contains the library where the shared variable resides""
    If I uncheck FIFO RT option for this variable the arrow isn't broken anymore.
    I 've no idea how to correct this weird error?
    Autodeploy is on, and I've check copy / delete in diagram in tool/options\diagram
    regards,
    james

    Hello,
    I don't reproduce this error.
    Could you send your VI?
    Regards
    VéroniqueD
    NI France

  • How Can i retain the Shared Variable Values after PC rebooting

    Hi all,
    I am facing a paculiar problem with Shared Variables. I have an application in which shared variables are used for data communication.
    One of the application requirement is to retain the variable values eventhough PC is rebooted or started after crashing. 
    As per the my understanding, the variable values will retain eventhough the PC is rebooted. But here i can observe a paculiar problem like some library variables are retaing the values while some others not. I enabled logging for all the variables.
    I tried many ways. like logging enabled, logging disabled, changing variable names, changing process names etc... But i am not getting a consistent behaviour.
    I hope some you can help me in solving this issue.. "How Can i retain the Shared Variable Values after PC rebooting"
    Thanks and Regards,
    Mir

    Hi Blackperl,
    Thanks for the post and I hope your well. 
    What do you mean by not getting consistent behaviour.. this will all depend on excatly when the crash happens i.e. before the write or after. 
    Surely a better method would be to log the data to a file during the reboot...
    I beleived the value read back
    will be the default value for the shared variable's data type.
    The LabVIEW DSC 8.0 module adds more functionality to the shared variable, including initial values and alarms.
    If you enable an initial value on a shared variable, when the variable
    engine comes back on-line it will default to this value. Setting a bad
    status alarm for the shared variable is also a good way of handling
    this type of event. Additionally, if you are using a LabVIEW Real-Time
    target such as Compact RIO or Compact FieldPoint, it is appropriate to
    consider hosting the shared variable engine on the real-time target.
    These devices have watch-dog capabilities and are typically the
    hardware controlling the critical pieces of an application. Most
    Windows or PC-based targets do not have these fail-safes.
    I guess, if you could explain to me again that would be great. From my point of view, if I have a cRIO and a Windows PC. If the windows PC crashes, the cRIO will still update its shared variables. Then once the PC has started up its own shared variable engine, and the bindings are loaded, it will once again continue to update its copies of the variables.
    Please let me know what you think,
    Kind Regards,
    James.
    Kind Regards
    James Hillman
    Applications Engineer 2008 to 2009 National Instruments UK & Ireland
    Loughborough University UK - 2006 to 2011
    Remember Kudos those who help!

  • The shared variable does not exist????

    This seems really strange!!
    I already use several shared variables within my whole project without any problem. At this point, I created a new one (a boolean network published) and everything seemed just fine (no errors were detected in my VI and it runs normally). However, when the VI on my host computer tries to use the shared variable, it generates an error message saying "LabVIEW:  (Hex 0x8BBB0005) The shared variable does not exist." (see attached screenshot).
    What is going on? I can't find any help online about that... Can anybody help me with this please?
    Thanks!

    Hello,
    This error can occur if you have an incorrect Path specified under your Bind to Source section for the shared variable - this could be as simple as a typographical error in the defined path.  Double-check that portion of your shared variable definition, and hopefully it'll be as simple as finding a typo in your path.  You should be able to browse for your variable/path by clicking Browse and then selecting Network Items if your shared variable is on the network.  Can you find it by browsing?
    I hope this helps!
    Best Regards,
    JLS
    Message Edited by JLS on 10-05-2006 03:54 PM
    Best,
    JLS
    Sixclear

  • Programatically add description into the Shared Variables in library file

    Hello All,
    I have been successful to programatically create the shared variables.
    Now, i want to programatically add the description to these variables, is there any method through which i can progrmatically add the description into these variables?
    Regards,
    Nishant

     Hello Dennis,
    I haven't refuseed to change the icon but whenever i try to change the icon, i am getting nothing in my icon gallery and subsquently failing to change the icon.
    I am really sorry, fi that would have create problems. But, i have always tried to change it.
    Let try it once again.
    Regards,
    Nishant

  • Is there a way to reset the shared variable engine?

    I would like to be able to reset the SVE in a manner that is equivalent to what occurs during a hardware reset.
    My motivation for doing so is as follows:
    I have an cRIO app with lots of IOV's and NSV's that operate via the SV API and also with plenty of static nodes.  I am finding
    that on first run, from the DE, my CPU%=~55%.  On all subsequent
    runs my CPU%=~65%.  If I do a hardware reset or redeploy one particular
    NSV library then
    my cpu usage will return to ~ 55%.  I have tried isolating the area of code that accounts for this and have found that
    the problem centers around my initialization of one library of NSV's
    where I set its init value via the SV API.  The NSV references
    are all closed after writing without error.  So I am wondering if it
    is possible that the NSV ref's are not actually closing or possibly
    the setting of the inital value has some effect on the SVE so that subsequent runs get bogged down.
    Anybody have any ideas?

    Hello,
    If you redeploy your library, does that bring your CPU usage back down?  perhaps you can use that as a suitable workaround?  How exactly are you setting the initial value of your shared variables?
    Tejinder Gill
    National Instruments
    Applications Engineer
    Visit ni.com/gettingstarted for step-by-step help in setting up your system.

  • Should i initialize the instance variables or not?

    hi guys ,i am trying to learn java therefore if i miss something sorry.
    for example i have like this a class
    is it good thing to always initialize those variables or initialize like in this exam and initialize with constructor too ?
    public class SomeClass
         private double principal=1.0;
         private double rate=0.1;
         private int    years=1;
         private int    times=1;
         public static void main(String[] args)
    }

    878144 wrote:
    i guess i explicitly initialize them or i dont however java does it for me even i dont explicitly say int variable=0; however java will do it i guess also it doesnt make sense to me i do or compiler does.No idea what you're saying here. Try writing proper sentences with proper capitalization, grammar, spelling, and punctuation.
    why some people say yes some of them say no.if u dont do it then java does it also same thing.Reason to do it: Makes it clear what you want the initial value to be, and that you didn't forget to initialize it.
    Reasons not to do it: Redundant and cluttersome. Also, can lead to unexpected behavior in some cases involving subclasses.
    Ultimately, the decision is more about personal preference than anything.

  • Concurrent Thread accessing the shared variable

    Hi All,
    I need help on following issue
    I am working on java program that will have about ~500 threads reading per minute List<Object> and ONE task thread which will reset the List<Object> every 4 hours.
    Let imagine this following class,
    public class Cache {
    private static  List< Object> m_cacheList = null;
    privates static final Cache instance = new Cache(new AraryList<Object>());
    public getInstance(return instance );
    private  Cache (Listc){
         m_cacheList = List< Object>;
    public List<Object>  getCacheList(){
         return m_cacheList;
    public List<Object>  refreshCacheList(List<Object>  newData){
    m_cacheList = m_cacheList;
    500 Read Tread
    List<Object> list = Cache. getInstance().getCacheList();
    // this will iterate
    for(Object obj ; list ){
       //do something
    1 Write Tharead  every 4 hr
    List<Object> newData = ��..
    Cache. getInstance().refreshCacheList (newData);Since the read rate is so high, I am thinking about using work �volatile� rather then full synchronization.

    This looks fine to me, volatile should work fine. The assignment of a new cache is atomic so should not interfere with the threads accessing the cache object.
    As good practice however I would recommend that you should not let the cache object out of the class (make it private and do not provide a method that returns it) so that you can control the access to it. If you return the cache object then it is possible that another class that accesses it may try to perform an operation that is not thread safe. For example if two threads get a reference to the same list and one is using the iterator while another thread modifies it (i know this is not the intention now, but you should code with future use in mind), then you will get a ConcurrentModificationException. The options here are either let the Cache class perform the function on the list and never return it, or return a copy of the list in the "getCacheData()" function.
    This way you are keeping the state of the class safely encapsulated inside the class and can control all modifications to it.
    Hope that helps
    Paul

  • Using Shared Variables and Initialize Front Panel Binding (to PSP)

    Hi,
    I use LV DSC RT 8.2.1
    I have a Vacuum System That includes signals from - Pumps failure, Valves status, Vacuum gauge, start Pump ...
    Each signal is read by a FieldPoint. 
    All the relevant FieldPoint Channels are read by the Server (a computer in the Ethernet Network) and published to the network in the form of Shared Variables.
    I have a client VI that is reading the Shared Variables published by the Server using Front Panel Binding.
    Problem : 
    Some of the Bindings are in the mode 'Write &Read' and that causes some initialization problems.
    For example - Valve #1 is Open, and then a User start running the Client VI, (the Valve #1 Status mode is 'Write & Read")
                           if in the VI the status of Valve #1 is closed (before running it) then the Valve status is changing to Closed.
    I want the Client VI to first read the Physical status of the instrument and then to change the Value if the User changes it.
    But that's seems to be a problem when using Front Panel Binding... (is it?)
    I know I can Deploy a lvlib in the Client Side and Item Bind to the Shared Variables or Use DataSocket.
    (Is DataSocket is a Reliable method when connecting to Shared Variables? What are the disadvantages when using DataSocket?) 
    What is recommended by those of you that are experienced or by NI ?
    Sincerely Yours,
    Amitai Abramson.

    Amitai Abramson,
    Hello and thanks for using the NI Forums.
    I'm glad that you've read the Using the LabVIEW Shared Variable Tutorial on our website. Check out these other resources:
    Network Variable Technical Overview
    Troubleshooting Network-Published Shared Variables
    Why Do I See Unexpected Value Change Events for Shared Variables Using LabVIEW DSC?
    All You Need to Know About Shared Variables
    Creating a Value Change Event for Shared Variables
    Alternative Method for Using Shared Variables Between Systems in LabVIEW 8.x
    What Is The Difference Between Using Shared Variables And DataSocket VIs To Access OPC Tags?
    The issue that you are seeing by having "Write & Read" bound items on both the server and client side is essentially a race condition, you don't know which one is being read/written at what time. To resolve this issue I would take a look at some of the documents below.
    Using a Local, Global, or Shared Variable in Parallel Loops Can Cause Race Conditions
    Using Local and Global Variables Carefully
    Tutorial: Local Variable, Global Variable, and Race Conditions
    Locking a Shared Resource or Variable in LabVIEW Using Semaphores
    You mentioned not wanting to have two sets of shared variables (one on each side), but this is a great method to resovle this issue, that, or you can develope some sort of hand shaking to prevent these race conditions.
    I would suggest that in the future when using these forums you try to ask only one question per thread and make it more concise. It's hard to tackle multiple questions and such broad questions as "I want to know all the ways that I can connect to Shared Variables, and I want to know the advantages and disadvantages." I suggest this because we want you to get your questions answered and more concise questions will result in quicker and better answers. 
    Message Edited by Ben S on 10-01-2009 06:05 PM
    Ben Sisney
    FlexRIO V&V Engineer
    National Instruments

  • Shared Variable Initializa​tion

    For whatever reason if I use shared network variables over the network they take 20 seconds each to initialize... after all of them initialize they are very fast.  Does anyone know why it would take exactly 20 seconds for this to occur?  If i look at the variables in variable manager i can see the update values and they are exactly 20 seconds apart.  This occurs weather i'm using a library with 20 variables or one with only 1 variable. 

    Hi Tak321,
    You can change the gateway address in the network properties on Windows (if that is the operating system you are using), however, doing so could disrupt your communications to your building network.  It does sound like it is possible that the shared variables are routing through the other network.  You could try disabling that network adapter to be sure.  It is also possible to bind shared variables to a specific network card: http://digital.ni.com/public.nsf/allkb/D358BABAE2F​61F1A862571570056867D?OpenDocument
    Regards,
    Jeremy_B
    Applications Engineer
    National Instruments

Maybe you are looking for

  • Can someone decipher this crash report for me please? :(

    I have no clue why this is crashing.  Its just a simple TweenMAX that calls a function onStart and onComplete. I dont know what all these references are to apple.Music I see a lowMemory error as well ..  but my Profiler is showing that I'm hardly usi

  • Print Server 2012 R2

    Hi, I am planning to implementation of Print server 2012 r2, but I am little confusion, below futures are available in 2012 r2? Machine Name User Name Document Name Date /Time Printer Name Page count  Limitation of printing  Thanks,

  • Date Format in DD-MM-YYYY in Module Pool

    Hi, How can I show date in DD-MM-YYYY Format in Module Pool Thanks

  • You are unable to log in.

    Hello everyone. This is my first post and alas it has to be about firevault error. I recently bought my new macbook pro and i used the migration assistant to transfer all my data from my old macbook which runs on leopard. Everything seems fine until

  • Chat on Facebook using Safari

    Whenever I receive a chat message on Facebook I get this error or whatever: Safari can't find the internet plug-in. Some content on the page "Facebook | Home" can't be shown because its MIME type is unspecified. So ya what do I do?