Change a global variable with a function

HI ALL!
I have the following problem...
I would like to change a global variable with a void function so not like this: variable = function(); .
What do you suggest?
Best regards,
Korcs

I have the following problem...
I would like to change a global variable with a void
function so not like this: variable = function(); .
What do you suggest?>
>
I dont quite understand your question but if your variable is a reference to an object then you can certainly have a method to alter the object that the reference is pointing to and/or the reference itself..
otherwise your 'function' will have to return the same type as the variable itself in order to do the assignment as you demonstrated, regardless of wether it's C, C# or Java, AFAIK, WIRNM
HTH

Similar Messages

  • How to auto create a global variable with specific variable name in a global vi ?

    how to auto create a global variable with specific variable name in a global vi using lv ? Because i need to add a lot of global variable in this global vi. But you know, if  i manually add them , it will be a much time-costing work. So i want to use someway to auto generate ? Can i ?? Thanks a lot !

    Hi
    what aartjan is saying is the way for you. but you can develop an utility which will actually help you create global variables. To get the details on this just have a look at VI Scripting section on LAVA forum.
    But i would like you to suggest few things
    1. If your programs have so many global variables (Thats why u want utility) then you should take out some time to read about LabVIEW design patterns. I think if programmer follows these practicess he dont need a single global variable.
    2. Their are some other ways to achieve similar functionality as of global variables (Uninitialized Shift Registers, Single Element Qs and so on) but they are much faster than global variables.
    I am Attaching Whatever Resources i am having I will also attach the template of the design pattern i generaly use in short duration
    Message Edited by Tushar Jambhekar on 10-06-2005 07:33 PM
    Message Edited by Tushar Jambhekar on 10-06-2005 07:36 PM
    Tushar Jambhekar
    [email protected]
    Jambhekar Automation Solutions
    LabVIEW Consultancy, LabVIEW Training
    Rent a LabVIEW Developer, My Blog
    Attachments:
    LabVIEWDesignPatterns.zip ‏1505 KB
    Large_Code_Implementation.zip ‏522 KB
    Database Tests.zip ‏868 KB

  • How to modify global variable in a function?

    Hello,
    I want to modify a globalvariable in a function, at first I did it this way:
    class Global_output_class
    GlobalDim("Correlation_Status,fail_part,End_Exp")
    dim pouet
    Correlation_Status = 12
    Call Correlation()
    pouet = Correlation_Status
    Function Correlation()
    Dim Global_output_class_sub
    Set Global_output_class_sub = new Global_output_class
    Correlation_Status = 1
    fail_part = 2
    End_Exp = 3
    Global_output_class_sub.CorrelationStatus = Correlation_Status
    Global_output_class_sub.failpart = fail_part
    Global_output_class_sub.EndExp = End_Exp
    set Correlation = Global_output_class_sub
    End function
    In this case: correlation_status receive the value 12, then I go to my function correlationn() where it became 1
    Then it goes out of the subfunction and takes the previous value from the program(12) ( I dont want that)
    To solve the problem I made it this way:
    class Global_output_class
    public CorrelationStatus
    public failpart
    public EndExp
    end class
    GlobalDim("Correlation_Status,fail_part,End_Exp")
    Correlation_Status = 12
    Set Global_Output = Correlation()
    Correlation_Status = Global_Output.CorrelationStatus
    fail_part = Global_Output.failpart
    End_Exp = Global_Output.EndExp
    pouet = Correlation_Status
    Function Correlation()
    Dim Global_output_class_sub
    Set Global_output_class_sub = new Global_output_class
    Correlation_Status = 1
    fail_part = 2
    End_Exp = 3
    Global_output_class_sub.CorrelationStatus = Correlation_Status
    Global_output_class_sub.failpart = fail_part
    Global_output_class_sub.EndExp = End_Exp
    set Correlation = Global_output_class_sub
    End function
    This way my global value are recopied in themselves after leaving the subprogram
    I got a lot of variables, is there any easier way so the global variable modified in a function keep the value after leaving the function?
    Thanks for help,
    Fred
    Solved!
    Go to Solution.

    Hi Fred,
    it is possible to use a global defined variable but the better way is to use to use a funtion call (or procedure call) with parameters. Please find first the good solution for a funcion call with parameter and the sub-optimal way with an global valiable:
    dim oParameter
    set oParameter = new cGlobal_output_class
    oParameter.Correlation_Status = 12
    msgbox "Correlation_Status before Call Correlation: " & oParameter.Correlation_Status
    Call Correlation(oParameter)
    msgbox "Correlation_Status after Call Correlation: " & oParameter.Correlation_Status
    Function Correlation(oPara)
    msgbox "Correlation_Status in the FUNCTION before change: " & oPara.Correlation_Status
    oPara.Correlation_Status = 1
    oPara.fail_part = 2
    oPara.End_Exp = 3
    msgbox "Correlation_Status in the FUNCTION after change: " & oPara.Correlation_Status
    End function
    class cGlobal_output_class
    dim Correlation_Status,fail_part,End_Exp
    end class
    call GlobalDim("oPouet")
    dim oPouet
    set oPouet = new cGlobal_output_class
    oPouet.Correlation_Status = 12
    msgbox "Correlation_Status before Call Correlation: " & oPouet.Correlation_Status
    Call Correlation()
    msgbox "Correlation_Status before Call Correlation: " & oPouet.Correlation_Status
    Function Correlation()
    msgbox "Correlation_Status in the FUNCTION before change: " & oPouet.Correlation_Status
    oPouet.Correlation_Status = 1
    oPouet.fail_part = 2
    oPouet.End_Exp = 3
    msgbox "Correlation_Status in the FUNCTION after change: " & oPouet.Correlation_Status
    End function
    class cGlobal_output_class
    dim Correlation_Status,fail_part,End_Exp
    end class
    Greetings
    Walter

  • How can I run two different vi's in same project which are accessing same global variable with out effecting the speed of the execution of both the vi's

    Hi
    I have build an Labview project with FPGA target .  I have configured an FPGA VI and an host Vi to acquire data and logged the data to a file and stored the latest data in a global variable simultanously. I have configured one more VI in the same project  to access the global variable.  I have build a dll to access both the VI as functions in LabWindows/CVI code.  My task in CVI is to update configured GUI with latest data periodically and run the  host VI continously for a long time and log the data to a file. GUI should update for every one second with latest data for this I am using the second VI in which I am accessing the global varibale in which the latest data has been stored in host VI.

    Duplicate Post (go here)

  • Using a global variable within a function

    Hi all,
    I'm trying to learn how to use global variables, but can't quite get it right:
    Im trying to use two buttons, named UpButton and DownButton to control one global variable, p1
    A text field, named "Value" displays p1.
    Here's my code:
    p1 = 0;
    ButtonClick("UpButton", p1, 100,"Value");
    ButtonClick("DownButton", p1,(-100),"Value");
    function ButtonClick(ButtonName,Var,Increment,TextToChange){
                        sym.$(ButtonName).click(function(){
                        Var = Var + Increment;
                        sym.$(TextToChange).html(Var);
    However, it seems to be treating p1 as two different variables.
    Here's a link to the page to show you what I mean, apologies but this link wont work in google chrome because I'm using dropbox as a server temporarily
    In other browsers you may need to click "Show all content" or similar to any security warnings...
    https://dl.dropboxusercontent.com/u/83693404/ButtonTest/buttons.html
    Here are the project files:
    https://app.box.com/s/0shocivto8fl295h62uq
    Any help greatly appreciated, sorry if this is a stupid question,
    Katherine

    Hi Katherine,
    However, it seems to be treating p1 as two different variables.
    Indeed, your code created two different variables in two different scopes (I guess it as to do with JavaScript closures, but do  not ask me more, I am still a bit foggy about that idiosyncrasy ).
    In JavaScript, a primitive parameter – this is the case here with p1, a Number value –, is passed by value. In other words, a copy of the value is made. Your code handles two copies of the value stored in p1.
    This contrasts with an object parameter, which is passed by reference (address in memory), without copy. Your code would work if Numbers were passed by reference : the two Var (p1) would then point to the same address.
    The intent behind your trial is a global variable.
    1) Let us be as simple as possible :
    Stage : document.compositionReady event handler
    p1 = 0;
    buttonClick = function( Increment)
      p1 += Increment;
      sym.$( "Value").html( p1);
    Stage : DownButton.click event handler
    buttonClick(-100);
    Stage : UpButton.click event handler
    buttonClick(100);
    Without being preceded by the var keyword the variables are global.
    So the Number variable p1 can be accessed inside function buttonClick.
    And the Function variable buttonClick as well, is accessible inside click event handlers, everything (function definition +function calls) being inside the same symbol (Stage).
    2) Now, suppose this is no longer the case : you want to access a variable from another symbol.
    We create a new GraySquare symbol, instantiated both in the DownButton symbol (instance name DownSquare) and in the UpButton symbol (instance name DownSquare).
    Stage : document.compositionReady event handler
    p1 = 0;
    sym.buttonClick = function( Increment)
      p1 += Increment;
      sym.$( "Value").html( p1);
    The sym. prefix is now necessary to make the variable (here a Function, but you would proceed exactly the same with a String, Number or Boolean) accessible in other symbols.
    DownButton symbol : DownSquare.click event handler
    sym.getComposition().getStage().buttonClick( -100);
    UpButton symbol : UpSquare.click event handler
    sym.getComposition().getStage().buttonClick( 100);
    From these other symbols, the sym.getComposition().getStage(). prefix is necessary to acces to our global variable (function).
    The two examples are downloadable here : https://app.box.com/s/6vkyiqk7i8zwlw0j1wk1
    Gil

  • SEM-BPS Variable with exit function

    Hi,
    this is my problem. I use a variable for period and I increment the variable dinamically in a sequence of execution. When I try to read the variable with a exit function, the function is only called the first time and return ok the value, but the next time the function not called and the value is returned from the buffer (I think this, because always is the same value).
    How can I change this? I need to my function return the variable value, because is changed.
    Thanks.

    Hi,
    thanks for replys.
    I think the problem occurs after update the patch level to level 15. This is the code of class_constructor in class cl_sem_variable:
    method CLASS_CONSTRUCTOR.
    data ls_dark type upc_dark2.
    select single * from upc_dark2 into ls_dark
       where param = c_param_dark_buffer.
    if sy-subrc = 0 and ls_dark-value = 'X'.
        m_buffer = 'X'.
    endif.
    endmethod.
    The flag m_buffer is always X and for that reason my the value of the variable is read from the buffer and the exit function for read variable isn't called.
    What do yo think about this?
    Thanks.

  • [Bash] How to `declare` a global variable inside a function?

    #!/bin/bash
    # Not using declare -A, array will be treated as indexed array rather than an associative array
    seta()
    for ((n=0;n<$1;n++)); do
    printf -v a_$n[k] %s k$n
    printf -v a_$n[j] %s j$n
    eval echo inside seta: a_$n[k] = \$\{a_$n\[k\]\}
    done
    seta 3
    echo outside: a_0[k] = ${a_0[k]}
    echo outside: a_0[j] = ${a_0[j]}
    echo
    # Use declare -A inside function, array will be undefined outside
    setb()
    for ((n=0;n<$1;n++)); do
    declare -A b_$n # Note here
    printf -v b_$n[k] %s k$n
    printf -v b_$n[j] %s j$n
    eval echo inside setb: b_$n[k] = \$\{b_$n\[k\]\}
    done
    setb 3
    echo outside: b_0[k] = ${b_0[k]}
    echo outside: b_0[j] = ${b_0[j]}
    echo
    # The bad solution, only works if we know beforehand how many c_? arrays will be assigned inside setc()
    for ((n=0;n<3;n++)); do
    declare -A c_$n
    done
    setc()
    for ((n=0;n<$1;n++)); do
    printf -v c_$n[k] %s k$n
    printf -v c_$n[j] %s j$n
    eval echo inside setc: c_$n[k] = \$\{c_$n\[k\]\}
    done
    setc 3
    echo outside: c_0[k] = ${c_0[k]}
    echo outside: c_0[j] = ${c_0[j]}
    My original code does the declare -A as in setb(). I was surprised when I saw all blank output... Now the problem is illustrated clearly by the setb() example.
    The setc() example works, but a bit ugly: look at the two 3's...
    My ideal solution would be, something like `declare_global -A b_$n` in setb()
    Any ideas?

    with current bash versions, i don't think it is possible to declare global associative arrays in functions.
    what you are after is the "-g" option of typeset which is available in zsh.
    i think i read somewhere that something similar may be planned for bash 4.2.

  • Need a TestStand 2.0.1 global variable with persistence.

    I was hoping to use G_DIO_Config_OK, a file global variable, to tell me in the SequenceFileUnload callback sequence whether I could safely try to power off my fixture. The default value is False, and I set it True in a couple of sequences, including the SequenceFileLoad callback. But, even though the sequence file properties are set to have "All Executions Share the Same File Globals", the file global reverts to its default value after the callback has run. Are file globals just not persistent? Do I have to use a station global instead?

    Hi gizmogal,
    Fileglobals are only available during sequencefile execution.
    You will have to use StationGlobals to achieve what you are after.
    Regards
    Ray Farmer
    Regards
    Ray Farmer

  • What can i replace this bind variable with in function?

    Hello
    I am creating a report showing training attended by employees. I have written a function to do the following:
    Parameters 1 - 4 is hard coded for a reason. So we dont worry about them.
    5th parameter: :START_DATE represents the date training started
    6th parameter: :END_DATE represents the date training ended.
    These date parameters are correctly used inside the select statement that the function is built upon. So don't worry that my date parameters are correct/incorrect.
    The focus should be on how you use bind variables inside Discoverer Admin. The select at the bottom runs perfectly in Toad and it allows you to use the date parameters as bind variables. But it does not allow it in Discoverer Admin
    The problem is with Parameter 5 and 6. I dont want to hard code the dates as i want the user to be able to enter his own date parameters.
    Discoverer Admin gives an error is i want to use :START_DATE and :END_DATE as parameters
    Does anyone have a solution for my problem.
    This is what the code looks like.
    SELECT apps.xxhr_fsc_training_info.xxhr_fsc_training ('A', '02','M', 'N',:START_DATE, :END_DATE)category_A_training
    , apps.xxhr_fsc_training_info.xxhr_fsc_training ('B', '02','M', 'N',:START_DATE, :END_DATE)category_B_training
    , apps.xxhr_fsc_training_info.xxhr_fsc_training ('C', '02','M', 'N',:START_DATE, :END_DATE)category_C_training
    , apps.xxhr_fsc_training_info.xxhr_fsc_training ('D', '02','M', 'N',:START_DATE, :END_DATE)category_D_training
    , apps.xxhr_fsc_training_info.xxhr_fsc_training ('E', '02','M', 'N',:START_DATE, :END_DATE)category_E_training
    , apps.xxhr_fsc_training_info.xxhr_fsc_training ('F', '02','M', 'N',:START_DATE, :END_DATE)category_F_training
    , apps.xxhr_fsc_training_info.xxhr_fsc_training ('G', '02','M', 'N',:START_DATE, :END_DATE)category_G_training
    from dual
    Edited by: iandekoker on Jun 8, 2009 9:34 PM

    Rod
    I have a request. The request is based on various emails written about passing parameters in Discoverer Admin/Desktop. Now if you are experienced and work with set copntext on regular basis then it should be a walk in the park. However if you are new to it like me, then it seems a daunting task. So my request is: Can't you provide us with an example of how to complete the whole process from begin to end using an actual example? I will kick off the process and maybe you can add where i left something out?
    Example:
    SELECT ENAME, HIRE_DATE
    FROM EMP
    WHERE HIRE_DATE = :IDATE;
    We want to run this select statement in Discoverer Admin, but Admin does not like the :IDATE bind variable. So now we are gonna use SET CONTEXT to find a solution to our problem.
    Step1:
    First we have to create a context namespace in the database for the Discoverer contexts. Here is the code to create the context. It is okay to also named your function EUL_DISCO as this name would work perfectly for almost everyone. Best is to do all of this in the Apps schema. Copy and paste this code in Toad and F9 it. It should compile successfully
    CREATE OR REPLACE CONTEXT eul_disco
    USING apps.eul_disco;
    Step 2:
    Now you need to create a package to enable you to set and retrieve contexts from in Discoverer. Here is the code to create the package and package body. Just copy and paste the code into Toad and F9 (execute) it to create the package.
    --Package Spec
    CREATE OR REPLACE PACKAGE eul_disco AS
    FUNCTION set_context(p_name VARCHAR2, p_value VARCHAR2) RETURN VARCHAR2;
    FUNCTION show_context(p_name VARCHAR2) RETURN VARCHAR2;
    END eul_disco;
    --Package Body
    CREATE OR REPLACE PACKAGE BODY eul_disco IS
    FUNCTION set_context(p_name VARCHAR2, p_value VARCHAR2)
    RETURN VARCHAR2 AS
    BEGIN
    dbms_session.set_context('EUL_DISCO', p_name, p_value);
    RETURN p_value;
    END set_context;
    FUNCTION show_context(p_name VARCHAR2)
    RETURN VARCHAR2 IS
    BEGIN
    RETURN SYS_CONTEXT('EUL_DISCO', p_name);
    END show_context;
    END eul_disco;
    Step3:
    Once you have created this package successfully you need to log into Discoverer Admin. Then use the menu to navigate to Tools > Register PL/SQL Function. A window called 'PL/SQL Functions' will appear. Select the 'Import...' button. A new window called 'Import PL/SQL functions' will appear. Scroll down until you see set_context function. Once you found it click OK to import it to End User Layer. Do the same to import show_context function. Remember there are two functions and you need to import them both. When you are done, click 'Apply' button. Then click 'OK' button. You can double check to make sure your functions have been imported. Just nagivate to Tools > Register PL/SQL function again. When the window 'PL/SQL Functions' appears your function(s) should be in the list on the left hand site. Scroll down untill you find them.
    Step4:
    Now it is time to set your session parameters in a separate worksheet inside Discovere Desktop from your main reports. The following steps show you how to create a worksheet to define an effective date parameter. The parameter worksheet should be based on a folder that always returns exactly one row.
    Log into Discoverer Admin. Open the Business Area you want to use. Then create "New Custom Folder..."
    Copy and paste this code (select sydate from dual) inside the New Custom Folder and validate the code. Also rename your folder to 'Set Context Folder'
    Step 5
    Next log into Discoverer Desktop and choose 'Create New Workbook'. Then choose table layout option. In the available list choose 'Set Context Folder'. When you have highlighted 'Set Context Folder' click on '>' button. Then click then 'Finish' button. Once the workbook is created you will see 1 column called Sysdate and a row with today's date in it. Save this workbook and name this workbook XYZ. You might even rename the sheet to QWE.
    Step 6:
    Still in Desktop working on XYZ workbook on QWE sheet, click on Tools > Parameters > New. In the 'Name' field enter START_DATE. Next leave 'Create condition with operator' box unticked. Next in 'Prompt' field enter START_DATE. In 'Description' field enter START_DATE. In 'Default' field enter NULL. Click OK button when you are done.
    Step 7:
    Still in Desktop working on XYZ workbook on QWE sheet, click on Tools > Calculation > New. Click on 'Functions' radio button. Then click on 'Database' folder to expand it. Scroll down till you see 'Set Context' function in the list. Select it and click 'paste >>' button. It will now show: SET_CONTEXT(P_NAME, P_VALUE). Now you need to replace the two parameters (P_NAME, P_VALUE) of the function. Replace P_NAME with 'START_DATE'. When you are done click on Items radio button. Then click on the Parameters folder and select Start_Date.
    When you are done it should look like this: SET_CONTEXT('START_DATE',TO_CHAR(:START_DATE))
    You might want to rename this calculation to START_DATE
    Ps. If you need to create two date parameters START_DATE and END_DATE then you repeat step 7 cause you need one more calculation.
    Just replace START_DATE with END_DATE. You also might want to call this second calculation END_DATE. Thus when you are done you will have 2 calculations:
    SET_CONTEXT('START_DATE',TO_CHAR(:START_DATE))
    SET_CONTEXT('END_DATE',TO_CHAR(:END_DATE))
    This is useful when you want date parameters similar to: 'where date between :Start_date and :End_date'
    Step 8:
    When you now run the XYZ workbook (QWE sheet) it will prompt you for an START_DATE. Enter 10-Jun-2009 (make sure the format you enter the date is similar to the format you have set up in discoverer). Now your XYZ workbook have 2 columns. First column is still called Sysdate with today's date. The second column is called START_DATE with 10-JUN-2009 in it.
    Step 9:
    Now you want to remove the 'SELECT SYSDATE FROM DUAL' data stored in 'SET CONTEXT FOLDER' from your XYZ workbook (QWE sheet) as you no longer need that. Still working with Desktop inside XYZ workbook on QWE sheet > click on Sheet menu option > then Edit Sheet option. On the Select Items tab click on 'Set Context Folder' and click < button to remove the folder from workbook XYZ. Click OK when done and run the workbook XYZ (sheet QWE) again. Now the workbook XYZ (sheet QWE) should only have one column called START_DATE and 10-Jun-2009 as the only row.
    Step 10:
    Rob you might want to come in here. It is also useful to create another calculation retrieving the value of the parameter, so that the value entered for the parameter can be seen when the workbook is run. Please give step by step instruction to complete this process
    Step 11:
    Still remember your initial problem where we wanted to use :IDATE in Discoverer Admin folder, but Discoverer Admin did not like the :IDATE syntax?
    SELECT ENAME, HIRE_DATE
    FROM EMP
    WHERE HIRE_DATE = :IDATE;
    Solution:
    Well now you just replace :IDATE with TO_DATE(SYS_CONTEXT('EUL_DISCO','START_DATE'))
    Log into Discoverer Admin. Open your Business Area. Then create 'New Custom Folder..'.
    Copy the code below and paste it into the new custom folder.
    Then validate the code.
    Rename the new custom folder to 'Solution'
    --copy and paste this code into folder 'Solution'
    SELECT ENAME, HIRE_DATE
    FROM EMP
    WHERE HIRE_DATE = TO_DATE(SYS_CONTEXT('EUL_DISCO','START_DATE'))
    note: 'EUL_DISCO' is the name of the context and package you created in step1
    : 'START_DATE' is the name of the calculation you did in step7
    Then log onto Discoverer Desktop > open your workbook XYZ > open sheet QWE.
    Click on Menu item called Sheet > New Sheet > choose Table layout > click next > scroll down available folders till you find SQL folder with then name 'Solution'. Select 'Solution' folder and click > then click Finish.
    The folder named 'Solution' will be used to populate the newly created sheet with data. You might want to rename the newly created sheet to 'Finally'.
    At this point workbook XYZ should have 2 sheets (QWE and Finally).
    Sheet 'QWE' contains the parameter and nothing else.
    Sheet 'Finally' displays the code found in folder 'Solution'
    First you run sheet QWE to set parameter. When prompt for a date enter '10-JUN-2009'. Click OK button.
    Then click on sheet 'Finally' to allow the parameter to take effect and do its job. You will see that only data true of 10-JUN-2009 are displayed
    Notes:
    This is a very simple example. But if you work thru this example, then you will get the concept behind the idea and would you be able to satisfy your own need.

  • Changing Global variables inside function

    Hello all,
    Trying to set a global variable in a function that had already been set before the function. For example:
    $VariablesAreSame = $false
    function CheckIfDifferent ($variable1, $variable2){
    If($variable1 -eq $variable2){
    $VariablesAreSame = $true
    write-host $VariablesAreSame
    for($i=1;$i -le 5;$i++){
    CheckIfDifferent $i 2
    When this is run, $VariablesAreSame is never permanently set within the function, which I would like it to be. Any ideas?

    You need to set $VariablesAreSame as a global variable in the function.
    $VariablesAreSame = $false
    function CheckIfDifferent ($variable1, $variable2){
    If($variable1 -eq $variable2){
    $global:VariablesAreSame = $true
    write-host $VariablesAreSame
    for($i=1;$i -le 5;$i++){
    CheckIfDifferent $i 2

  • Adding tab to typedef tabcontrol causes class conflict with global variable

    Hi,
    I am quite new to labview. I have to update an existing program and I have a problem whith a tabcontrol. In attachement, I give you a very simple solution showing my problem.
    I have defined a simple tabControl in a typedef ctl. I had it to a VI and in block diagram of this VI, I want to fill a global variable with this control and this global variable is set as "Include Data Type".
    When creating my ctl file with a simple tabcontrol, there is no problem but my tabcontrol only contains 2 tabs. When I use "Add page after" in my ctl file to create a third one, after saving, I get a class conflict error on wire to global variable in my block diagram.
    If I remove added page, all is OK again. I don't understand why adding a new page causes a class conflict. In my attachement, it is very simple but in program that I have to modify, I already have 15 tabs and I just want to add a 16th one so, I am sure there is a mean, but impossible to fond it after many hours...
    If someone can tell me how to make my example works with "Include Data Type" (if I remove it, it always works but that is not what I want) and adding an additional tab, it would hemp me a lot!
    Thanks in advance.
    Yohann
    Attachments:
    test2.zip ‏11 KB

    The problem is that the tab is an enum, and you can't wire two strictly typed references of two different enums together, because they are considered different data types. What you can do is right click the reference control in the global variable and select Show Control, which will show the data type of the reference. You can then replace the control inside the reference with the typedef, which will cause it to update correctly.
    Although that will solve the problem, if you have the reference to a tab control in a global variable, you probably have some issues with your code, but that's not something which can be commented on without more details.
    Try to take over the world!

  • Setting the value of an Application Item (setting a global variable);

    In APEX 3.2.0.00.27, I need to initialize a global variable to 0 to implement a variable for testing to see if anything on the page has changed. Will update to 1 when certain select lists on the page are changed. Have read through some similar questions and replies within the forum as well as other blogs and sites. So, I believe what I am doing is the way to go about this. Unfortunately, my initialization of an application item/global isn't happening yet. here's a rundown of what has been implemented:
    1) created an application item, G_CLASSIFICATION_ID_NEW in the shared components;
    2) created Javascript (JS) function called by addLoadEvent in the page html header region so when the page loads, the G_CLASSIFICATION_ID_NEW global/application item should get set to 0 with the following JS and using AJAX and htmldb_GET:
    <script type="text/javascript">
    function initVars()
    alert("before get initvars");
    var get = new htmldb_Get(null,$x('pFlowId').value,null,22);
    get.add('G_CLASSIFICATION_ID_NEW', 0);
    gReturn = get.get();
    if(gReturn){
    alert(gReturn.value);
    get = null;
    alert("after get initvars");
    alert("before call to initpage");
    addLoadEvent(initVars());
    </script>
    I've used the htmldb_Get with success for populating other global variables and running On Demand Processes with onchange JS calls in the html form element attributes within select lists on the page. Afterwards, I can check the globals via the Session window and searching on Application Items. Unfortunately, I'm missing something because my G_CLASSIFICATION_ID_NEW never gets populated when I load the page. The alerts all popup when the page is loaded, so I know the script is being executed when the page loads. the alert(gReturn.value) comes back undefined. And, needless to say, the G_CLASSIFICATION_ID_NEW to 0 is not occurring.
    I've tried the htmldb_Get with it calling an application process and without (set to null). From what I've read, you shouldn't need to call an on demand process to have the get.add set the global variable. Then again, this could be where I'm going wrong. however, as I've mentioned, this works for other functions called from an onchange to populate an application item, but the page has already loaded when the onchange(s) get executed. They may work because the page is already loaded when the onchange is called. My point here is that my other On demand processes are NOT setting or changing the global variables at all. The globals are getting set with the get.add(<app item>, <value>) portion of my other JS functions within the HTML Header region. So, I'm inclined to believe that I don't need the 'application_process=<some_odp>' parameter set, but if that's not true, please let me know. if so, what would need to be in the on demand process--ie, what would be the purpose of the get.add(<application item>, <value>) if I set the global variable in the on demand process because that's the only thing I could think of doing within an on demand process for this?
    If somebody can point out what I'm not understanding or failing to do here, that would be great. I'm doing fine with APEX, but wouldn't consider myself a guru with it just yet. I'm definitely not a JS/AJAX guru, and when things like this go astray, I get bogged down because I'm not sure of the problem. So, I'm hoping you gurus who monitor this forum can get me going in the right direction.
    thanks,
    bob

    Hi Jari,
    Does that javascript work if you place it some of region footer on page 22 ?Yes. I cut it out of the html header of the page, and put it in the footer of the first region on the page. It initializes the variable. Putting it into the footer of the first region on the page should work for me instead of having an extra region on the page that's being picked up from page 0.
    Is your page 22 authentication public ?No. This particular page is set for an ADMINISTRATOR only. That said, I am logged in as an administrator. So, I cannot see why setting authentication should make a difference as long as I have that authentication/authorization. Also, there will be other pages where I want to use this script or a similar script, but again, those pages will not be open to the public. the authentication will be "role" based where a user will not necessarily have to be an administrator, but they will have to have a certain role to access the page. Is there a known problem or something that precludes a html header JS script from doing an addloadevent when authentication is NOT public?
    thank you,
    bob

  • Import/export to memory and global variables

    Hi,
    Im working on some functionality using import/export to memory. One of the statements is:
    import gf_memid_exit = g_exit_flag gf_memid_result = t352r from memory id 'ZREV_EXT'.
    Im using global variables to contain the cluster names. But this is not working. When I change the global variables into local variables, it works. It this normal? Because I would like to have global variables (even better I would like to have global constants) to declare in order to use them within the program.
    Any ideas?
    With regards,
    Mike

    Hi Mike...
    I think with import u can use global or local variables..in debug mode pl. check when u r using global variables..whether it is getting cleared or overwritten by some other values or not. Or try with global constants..it should work...
    Regards,
    Joy.

  • Global variable readonly

    I chose to try/use a global variable to resolve a complex situation I was having.  I followed the "Creating Global Variables" from LabVIEW help and everything seemed to work fine.  The global stopped working, however, when I checked my files into CM and the xxxGlobal.vi (created by the global variable process) was readonly.  I didn't see a runtime error, but the global always returned the default.  Then, when I changed the file's attributes (enchecked readonly), I could exercise the other functionality.
    Is this a known issue - do I have to make this global.vi read/write for all users, or is there another solution?

    I don't think my conclusion (above) is correct.  I had a case statement error that made it appear that the readonly was the issue, when it was not.  I'm not sure what the deal is now.  Here is what I did.
    I placed a global variable(gv) in the block diagram of one VI, then double clicked on the gv and got a blank vi.  I dropped a text control onto the front panel and named it ReportFormat.  I then did a "save as" to save the new (global) VI.  I then added some logic (where I originally dropped the gv) to populate the global variable with the user's selection from a drop down (two possible choices) .  I then went to another VI and in its block diagram I did a "Select VI", found/selected this global.vi I just created.  Since I only have one item on the front panel (in the global.vi), I received an association to ReportFormat.  I did a  "Change to Read" so I can use the string output to drive a case statement.  The default case is always selected, though.

  • Error with intersects function

    I've an error I don't understand the cause.(it worked before the SDK update)
    Here is my code :
         * Permet de vérifier que l'évênement passé en paramètre n'en chavauche aucun autre
        function detectCollision(guiEvent: DayEvent) {
            // On sélectionne tous les évênements affichés sauf celui pour lequel on test les limites
            for (e in app_events.displayedEvents.content[p | p.id != guiEvent.id]) {
                if (e.intersects(guiEvent.boundsInLocal.minX, guiEvent.boundsInLocal.minY+5, guiEvent.boundsInLocal.width, guiEvent.boundsInLocal.height-10) == true) {
                    guiEvent.guiEvent.stroke = Color.RED;
                    collisionsDetected = true;
                    break;
                } else {
                    guiEvent.guiEvent.stroke = Color.rgb(77,130,178);
                    collisionsDetected = false;
        }"DayEvent" is a Group...("e" too)
    The error is:
    "An internal error has occurred in the OpenJFX compiler."

    This is helpful... :-)
    I can reproduce the error with the simple code:
    var app_events: Node[];
    var collisionsDetected: Boolean;
    function detectCollision(guiEvent: Group) {
      for (e in app_events[p | p.visible]) {
        if (e.intersects(guiEvent.boundsInLocal.minX, guiEvent.boundsInLocal.minY+5, guiEvent.boundsInLocal.width, guiEvent.boundsInLocal.height-10) == true) {
          collisionsDetected = true;
          break;
        } else {
          collisionsDetected = false;
    }I suggest you report the bug to Jira / Kenai with the above code. If you don't want or cannot, just tell, I will do.
    *[EDIT]* I went ahead, since I could reproduce it, and made the bug [http://javafx-jira.kenai.com/browse/JFXC-3283]
    As guessed from the cryptic error, the problem comes from the break instruction. So a workaround is not to use it! :-) Or to change the instructions. Maybe the compiler thinks that break is supposed to be a value (implicit return).
    A possible solution is:
    function detectCollision(guiEvent: Group) {
      for (e in app_events[p | p.visible]) {
        collisionsDetected = e.intersects(
            guiEvent.boundsInLocal.minX, guiEvent.boundsInLocal.minY+5,
            guiEvent.boundsInLocal.width, guiEvent.boundsInLocal.height-10);
        if (collisionsDetected) break;
    }Simple, elegant (in my eye!) and compiling...
    A less breaking solution (ie. with minimal change to your code) is to say your function returns nothing: function detectCollision(guiEvent: DayEvent): Void
    Another, perhaps better, is to return true or false instead of changing some global variable.
    The compiler tries hard to guess the types, but sometime it fails and behaves badly or even crashes...
    Edited by: PhiLho on Jun 18, 2009 3:45 PM

Maybe you are looking for

  • Trouble with negative refinement filters and data source on OID 2.3

    Hi I'm having trouble using the negative refinement filters on a data source with Information Discovery 2.3 Here's the data source configuration "baseFunctions": [ "attributeKey": "COMPANY", "attributeValue": "PROMO", "class": "com.endeca.portal.data

  • Wildcards or regex in CSS dns-record

    Hi, is it possible to use regex or wildcards in dns-record command in CSS?. I would like to use something like dns-record a *.example.com 10.10.10.10 in order to CSS responds to test1.example.com and test2.example.com without introduce this last two

  • Trouble saving system files using resource hacker.

    I have a Windows 7 pc. I recently installed a new program called resource hacker which allows you to modify system files. I also on my computer have a Windows XP VHD which I also installed the program. I first tried editing the explorer.exe file on w

  • 8830 blackberry messenger help

    my messenger won't let me in.  People have added me to their contact lists, and when I press on the messenger icon, it tells me to "put your name as you want others to see it" type thing, I click "ok", then it says :your name cannot be empty. I press

  • HT4859 Moving movies from Cloud to Laptop

    I downloaded movies and TV shows to my laptop. Now I cannot access those shows because everything has been transferred to the Cloud Storage (without my prompting or opting for it). How do I get those items back on to my laptop's hard drive so that I