Global variable and timer

Hi,
I have a really amazing problem. I have a form with a when-new-from-instance-trigger. In this trigger I create a timer. The timer reads some information and should pass them to a global variable. For testing my form I pass additionally the global variable value to a text object. After the timer I want to use the global variable value for a where condition in a sql statement. But I get always the no_data_found exception and the value of the global variable is empty! What happens with my value? Does anybody know about such a problem? Please help.
Thanks Mandy

My question is, why are you starting a timer from a When-new-form-instance trigger? If all you are doing in the when-timer-expired trigger is some SQL lookup, why don't you do it directly in the when-new-form-instance trigger?
Timers, no matter how short a time span, do not expire (and run the when-timer-expired trigger) until everything else is done, and control switches to the user (form is ready to accept user input from mouse or keyboard). The only exception is in web forms where you start a timer with 0 (or maybe 1, I don't remember) millisecond -- in that case, Forms runs the when-timer-expired code immediately.

Similar Messages

  • How do I store VI References in global variables and access them later

    From what I know, Labview automatically deletes VI references when they go out of use. Is there a way for me to override this so that I can access a set of preloaded references in a separate VI? Essentially I would like to open the VI's dynamically into the memory, store the references in global variables and access them at a later time. The VI's I'm referencing won't be known until runtime. I know its not the safest way to do it, but it would be the most productive on my end.
    Thank you
    Clay Upton

    I'm not sure what you mean by "a later time", but a VI reference will remain valid as long as the VI is in memory. If you don't unload the VIs, the references will remain valid.
    If you do need to unload the VIs, for whatever reason, I would suggest the following:
    Create a functional global as your interface for obtaining the references.
    Feed the paths to the VIs into the VI when initializing it (since you don't know which VIs in advance).
    When calling the VI to obtain the references, have the VI check them first (using the Not a Number... primitive). If it sees that they're invalid, it can open a new reference and return that.
    You should note that when a VI is removed from memory, the data space is used is released, so if those VIs are expected to hold data (using shift registers, etc.) this will be a problem.
    The description I've given will only be usable in certain instances (and it has its intricacies), but you didn't really give any details about what you're actually trying to accomplish.
    Try to take over the world!

  • How can i find all global variable and parameters in a form?

    I don't know name of global variables and parameters,but i want get their name and value .
    how can i do? who can help me?
    Thank you.
    Daniel Liang
    2007.1.19

    no problem. As Francois said you can't do it programmatic in runtime.
    But when you use the debug-mode you can see each global with name and value.
    By the way: It's not good to not know all the globals in your application. This is one of the most important things you have to write down for your app. Create a wiki for such informations, so that all developer can share their information.

  • Declare global variable and retrive?

    Hi,
    we are working in live project in webtool, we wants to create global variable,
    calling that variable in a required pages, our questions is that where to declare global variable and how to declare in which page we have to declare?   pls guide us its very urgent and send the code.
    Regards
    Kannan.D
    Edited by: kannan desikan on Jan 14, 2008 8:07 AM

    Hi Kannan,
    I would suggest using a comma delimied list or putting it in the database.
    ArrayList myList = new ArrayList();
    myList.Add("one");
    myList.Add("two");
    myList.Add("three");
    string comma = "";
    // store the array in the session state
    foreach (string s in myList){
      Session["persistedArray"] += comma + s;
      comma = ",";
    To get the array back
    if (Session["persistedArray"] != null){
      ArrayList myList = Session["persistedArray"].ToString().Split(new char[1] {','});
    If your array is storing objects, you should use the database.

  • What's the difference between global variables and instance variables?

    hi im just a biginner,
    but what is the difference between these two?
    both i declare them above the constructor right.
    and both can access by any method in the class but my teacher said
    global variables are not permitted in java....
    but i don't know what that means....and i got started to confuse these two types,,
    im confusing.......
    and why my teacher said declaring global variables is not permitted,,,,,,
    why.....

    instance variables are kindof like Global variables. I'm not surprised you are confused.
    The difference is not in how they are declared, but rather in how they are used.
    There are two different "styles" of programming
    - procedural programming.
    - object oriented programming.
    Global variables are a term from Procedural programming.
    In this style of programming, you have only one class, and one "main" procedure. You only create one instance of the class, and then "run" it.
    There is one thread of control, which goes through various methods/procedures to accomplish your task.
    In this style of programming instance variables ARE "global" variables. They are accessible to all methods. There is only one instance of the class, and thus only one instance of the variables.
    Global variables are "bad" BECAUSE you can change them in any method you like. Even from places that shouldn't have to. Also if you use the same name as a global variable and a local variable, you can cause great trouble. This can lead to very subtle bugs, as the procedures interact in ways you don't expect.
    The preferred method in procedural programming is to pass the values as parameters to the methods, and only refer to the parameters, and local variables. This means that you can track exactly what your method is doing, and what it affects. It makes it simpler to understand. If you use global variables in your methods, it becomes harder to understand.
    So when are instance variables not global variables?
    When you are actually using the class as an Object, rather than just a program to run. If you are creating multiple instances of an object, all with different values for their instance variables, then they are not global variables. For instance you declare a Person object with an attribute "firstname". Your "main" program then creates many instances of the Person object, each with their own "firstname"
    I guess at the end of all this, it comes down to definitions.
    Certainly you can write procedural code in java. You can treat your instance variables, for all intents and purposes like global variables.
    I can only think to show a sort of example
    public class Test1
       User[] users;
       public void printUsers(){
         // loop through and print all the users
         // uses a global variable
          for(int i=0; i<users.length; i++){
            users.printUser();
    public void printUsers(User[] users){
    // preferred method - pass it the info it needs to do the job
    for(int i=0; i<users.length; i++){
    users[i].printUser();
    public Test1(){
    User u1 = new User("Tom", 20);
    User u2 = new User("Dick", 42);
    User u3 = new User("Harry", 69);
    users = new User[3];
    users[0] = u1;
    users[1] = u2;
    users[2] = u3;
    printUsers();
    printUsers(users);
    public static void main(String[] args)
    new Test1();
    class User{
    String firstName;
    int age;
    public User(String name, int age){
    this.firstName = name;
    this.age = age;
    public void printUser(){
    // here they are used as instance variables and not global variables
    System.out.println(firstName + " Age: " + age);
    Shit thats a lot of typing, and I'm not even sure I've explained it any good.
    Hope you can make some sense out of this drivel.
    Cheers,
    evnafets

  • Oracle Froms, Global Variables and Oracle Reports

    Hi all,
    We are developing a form that will call an Oracle report and we would like to test the value of a global variable that was set in the Oracle Forms in the "Before Parameter Form" in the Oracle report trigger. Can this be done?
    Thanks, Larry

    The "global" var. is global to either a report or a form, not both. You may pass them from one to the other but that's not the session-global thing.
    DC

  • Webdynpro - how to add global variables and common proj to existing proj

    How to add global variable in either ViewController or CustomController.  We realise that codes must be added within the begin and end exction.  Codes outside that will be deleted when saved. 
    How can we add a common WDP project to an existing project?  We have actually added a common wdp project at the project references screen.  But during runtime, we encouter error.  The error is classNotFoundException.  The class is the class created in the common project.

    Hi.
    I think you need to assign ProB to ProA.
    Step1.
    Open propety of ProjectA.
    Step2.
    Select WebDynproRefrences
    Step3.
    Select Sharing references
    Step4.
    Choose add button.
    Step5.
    If your projectA named "testapp" and you are not using
    DC "local/testapp" is the proper name.
    I hope that it work!!!.

  • Newbie thread about global variables and result set

    Hello everyone this is my first post, im from colombia and now im learning about this world !! the WCC !!
    Now im doing a practice but im so noob that i cant get it so far... i wrote some of the oracle documentation.. and it was so usefull for starting.. but now im trying to do custom components builded in java + resources + services + template etcc .. all good stuff :D.
    i want to retrieve a result set coming from a custom service ... and then i want to store this result set in some kind of global variable !! why ? because i want to use this data from the result set again and again without making more call to the service !!
    ive tried to copy this resultset but i think it cant be done because i use a popUp window to display the rows from the RS.. and when i close the window .. it dies!!
    i want to use this RS for 3 custom metadata field.. but i have no idea how to do this....
    this is a part of my custom resource
    <$if fieldName like "xElaborador"$>
    <$executeService("SERVICE_ALLUSERS")$>
    <$trace(" ### executing service ###","#log")$>
    <!--i tried to copy the rs here but this is wrong i guess -->
    <$nuevoRS="usuarios_LDAP"$>
    <$endif$>
    <!-- usuarios_LDAP is the RS parameter coming from the java calss -->
    <$if rsExists("usuarios_LDAP")$>
    <$if rsFirst("usuarios_LDAP")$>
    <$loop usuarios_LDAP$>
    <$trace(" ### inside RS ###","#log")$>
    <$include each_user_LDAP$>
    <$endloop$>
    <$else$>
    <$include therearenotusers$>
    <$endif$>
    <$endif$>
    <!-- THIS CODE IS USELSS BASICALLY-->
    <$if fieldName like "xRevisor"$>
    <$if rsExists("nuevoRS")$>
    <$if rsFirst("nuevoRS")$>
    <$loop nuevoRS$>
    <$trace(" ### inside rs for revisor ###","#log")$>
    <$include each_user_LDAP$>
    <$endloop$>
    <$else$>
    <$include therearenotusers$>
    <$endif$>
    <$endif$>
    <$endif$>
    pls tell me if im too lost im all ears to learn the good practices for this tool.

    Hi ,
    One of the good resource on this topic is :
    http://jonathanhult.com/blog/2012/11/resultset-versus-dataresultset/
    Thanks,
    Srinath

  • Word 2010 VBA - Global Variables in VBA and using them in VBA Code

    Hiya
    I need some help.  I have the following code that takes a word document, converts it to pdf and saves it to the local temp folder and attaches it to an email.  Up until now the filename for the file has been hard coded.
    I have now created a userform that allows the user to enter a filename for the document and I have created a global variable for the filename to be stored.
    What I want to be able to do is pick up this filename from the global variable and add it to filepath in the code.  At the moment it just saves the document as Mytitle which is what the variable is called.
    Here is my code, can I please have some help as I am a little lost, this is the first time I have created something so complicated!!
    Public Mytitle As String
    Private Sub CommandButton1_Click()
    ConvertandSave
    Createemailandattach
    End Sub
    Sub ConvertandSave()
    'converts to pdf and save locally using filename from userform
    ActiveDocument.ExportAsFixedFormat OutputFileName:="C:\temp\Mytitle.pdf", _
    ExportFormat:=wdExportFormatPDF, OpenAfterExport:=True, OptimizeFor:= _
    wdExportOptimizeForPrint, Range:=wdExportAllDocument, From:=1, To:=1, _
    Item:=wdExportDocumentContent, IncludeDocProps:=True, KeepIRM:=True, _
    CreateBookmarks:=wdExportCreateNoBookmarks, DocStructureTags:=True, _
    BitmapMissingFonts:=True, UseISO19005_1:=False
    End Sub
    Sub Createemailandattach()
    'creates email and attaches to the file
    Dim oOutlookApp As Outlook.Application
    Dim oItem As Outlook.Mailitem
    Dim MyFileName As String
    On Error GoTo SendCancelled
    MyFileName = "c:\temp\Mytitle.pdf"
    Set oOutlookApp = GetObject(, "Outlook.Application")
    If Err <> 0 Then
        Set oOutlookApp = CreateObject("Outlook.Application")
    End If
    Set oItem = oOutlookApp.CreateItem(ofMailitem)
    Set objRecip = oItem.Recipients.Add("   email address goes in here")
    obj.Type = olTo
    oItem.Display
    'oItem.Subject = "My Profile - "& UCase(LastName) & " " & FirstName
    oItem.Attachments.Add (MyFileName)
    Exit Sub
    SendCancelled
        MsgBox "This macro was cancelled"
    End Sub
    Any help here would be very much appreciated

    Assuming that you have other code to set the value of Mytitle: change all instances of "c:\temp\Mytitle.pdf" to
    "c:\temp\" & Mytitle & ".pdf"
    Regards, Hans Vogelaar (http://www.eileenslounge.com)

  • What is the difference between using a global variable,passing a valuee and using a reference?

    I have created a project that consists of several VIs.  Only the main VI has a front panel and the others perform functions.  The function VIs are dependent on controls on the main VI's front panel.  I have several ways of passing the value of the controls.  One is to use a global variable and just place it on the dependent VIs.  Another option is to strictly connect the terminal from the control to a VI connector block and pass the value directly.  My last option is to create a reference of the control and reference it inside the dependent VIs, but this would also require connections to be made to the VI block.
    What are the advantages/disadvantages of these options?
    -Stephen

    5thGen wrote:
    I have created a project that consists of several VIs.  Only the main VI has a front panel and the others perform functions.  The function VIs are dependent on controls on the main VI's front panel.  I have several ways of passing the value of the controls. 
    1) One is to use a global variable and just place it on the dependent VIs.
    2) Another option is to strictly connect the terminal from the control to a VI connector block and pass the value directly. 
    3) My last option is to create a reference of the control and reference it inside the dependent VIs, but this would also require connections to be made to the VI block.
    What are the advantages/disadvantages of these options?
    -Stephen
    1) Globals are evil and introduce race conditions.
    2) The sub-VI only get the value when it was called and updates that occur while the sub-VI is runing are not sensed by the sub-VI
    3) This uses property node "value" or "value signaling" both of which run the user interface thread which is single-threaded and you incur a thread swap hit to performance. You also have a potential for race conditions.
    The are various methods for sharing dat to/from sub-VI which include Queues and Action Engines.
    I hope that hleps,
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • How declear global variable in form and use all form

    hi master,
    sir,
    how i declear global variable in form and how use this variable in all form
    i have year table and pik current year or date form table and move in global variable and use in all form
    please give ma idea
    thanking you
    Aamir

    Ok, so, what characterset was your database created with?
    Does that characterset have a representation of that character?
    -Mark

  • How can I pass a value field to a global variable?

    I have a doubt,
    I wnat to know if is possible to pass a value field to a global variable inside of DataFlow?
    That a try to do is at the time to execute a JOB on line (real time), depending of the value field that i receive, only certain DATAFLOWS will be executed  depending of the value field.
    I hope you can help me.
    Kind regards!!!

    It can be done via various ways, your approach is kind of odd, though.
    You are saying you have one kind if Input message, depending on the flag you want to do different transformations. The way you envision that is by loading that flag into a global variable and use different dataflows then.
    Can you use different dataflows within one Realtime Job? Yes, usually the first loads an in-memory datastore.
    Can you write into a global variable? Yes and No. Not directly, but you can write the value into e.g. a database and using the sql() function read it from there. But why would you. You could write it into the in-memory datastore. And then you run your n dataflows, each has a filter. So only one of these dataflows will actually process the data.
    Are there other approaches? I would have a Case transform at the beginning and route the data into different queries depending on the data. So all in one dataflow. Your approach is fine for a batch dataflow where a dataflow is started, does something and then ends. But that's not how it works in Realtime!

  • 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

  • Global variable in BR

    Hi,
    I have created one global variable (run time prompt) in which Budget admin will pass the scenario member parameter and I have also created a local run time prompt in one rule(which will pick up the scenario member from the input form POV with which the rule attached to) and inside the rule I am checking one condition that if the global variable value is equal to the local variable, then it will execute one calculation.
    As I want that the modify priviledge to change the value of global variable will be only with Budget Admin, so I have defined that at the time of Global variable creation. I chose Member from scenario dimension with the default value 'Budget'.
    I have hidden the local variable in input form. I have set 'run on save' with the 'Use Members on Data form' and 'Hide' option. The default value for local variable is also 'Budget'.
    As I have not hidden the global variable, so at save, pop up coming for the global variable. My problem is that, if I do not hide the global variable, then other user can modify the value, so my purpose is defeated.Otherwise rule is running ok.
    And If I hide the variable, then error is coming "The following value is not valid for the run time prompt it is entered for: ."
    Not understanding what is missing here. Can you please suggest the relevant solution/work around...
    Thanks & Regards.

    Hi John,
    Thanks for the reply and suggestion. But,actually my purpose was to match the budget-admin's scenario with the user-input form's scenario (and depending upon that we will pick up other member intersections and do the calculation for those combination only. So, two set of BR execution seperately will not solve our problem.
    Meanwhile, I tried hardcoding the global variable for debugging, keeping only the local variable picking value from input form. Now getting error that value is not valid for prompt as below---
    "The following value is not valid for the run time prompt it is entered for: ."
    Is my local variable not picking any value from input form....
    Can you please put some light on the issue?
    Thanks & Regards.

  • Global Variable in JAVA

    Hi I am new to Java but have been programming in other languages for sometime.
    What I want to achieve is to have some global variables that I can use in other classes. This was particularly difficult because I want to use these global variable in Switch/Case statements. I thought this was solved by creating the following class
    public final class IntObj {
    public static final int ftsefut_contract_id = 2;
    so in another class i would use IntObj.ftsefut_contract_id in the switch/case and it worked. However, i now am begining to think this is not working. Usng NetBeans, if I change the value of ftsefut_contract_id from 2 to 3 and "clean and rebuild", I am still seeing the value of ftsefut_contract_id to be 2 and not the new value (ie 3) that I have inputed. Can someone please explain is there a better method of having global variables and if not how do I get NetBean or the project to flush itself and reload the new values each time I rebuild.
    Thanks

    That behaviour is explicitly permitted by the Java specifications.
    Use an enum.

Maybe you are looking for

  • Document not relevant for billing

    Hi experts, i want to create a forma invoice for delivery(delivery document type: NL), but i did not succeed. I have already assigned this billing type to NL under intercompany billing. The process of moving goods from one plant to another was also c

  • Difference testing in CS4 and on the Web

    I'm loading an external XML file using ActionScript 3.0 in Adobe Flash Professional CS4. When I test the .fla in CS4 (ctrl/enter), it does not load the correct .mp3 files in two out of six cases. Yet, when I upload the file to the Web and test it, it

  • TS1140 I upgraded hm phone and a lot of my recent pictures are missing

    I am missing a lot of my pictures since the upgrade and I backed up all of my photos on my icloud

  • Shortcut to new server volume mounts old server

    I have recently transferred all files from a Windows NT Server and a Windows 2000 Server to an OSX Tiger Server. I duplicated the files to the new server using Retrospect but have left copies on the old server in case anything was missed. On my four

  • Connect BO Universe to Adabas Database

    Hi! any experience with a connection to Adabase Database using BO Universe? Regards Mario