Referencing a variable

A bit of a stupid question i guess but if i have a variable declared in one class,how do i reference it in another class.
Example - I have created a text area in one class and i want another class to be able to reference this text area,thanks

A bit of a stupid question i guess but if i have a
variable declared in one class,how do i reference it
in another class.
Example - I have created a text area in one
class and i want another class to be able to
reference this text area,thanksYou pass this other class a reference to your text area. Where or how you pass it is up to you; it could be as a method or a constructor argument of the other class.
<pseudo>
class OneClass {
    private JTextField myTextField;
    public JTextField getThatTextField() {
        return myTextField;
class OtherClass {
    public OtherClass(JTextField text) {
        myText = text;
    public void someMethod() {
        myText.setText("Look here! I did this!");
OneClass one = new OneClass();
OtherClass other = new OtherClass(one.getThatTextField());
other.someMethod();Many variations are possible; you could construct your OtherClass with a OneClass and inside use the getter to get to the text field...
I suggest you give it a go, perhaps try some variantions to see which suits best in your concrete situation. If you run into a concrete problem, feel free to post the code you have (in [ code ] tags) along with a specific and complete description of the issue.
Additionally, it would probably do you good to read some tutorials indeed; google will help you. Search for "Thinking in Java" by Bruce Eckel (free download); it's one of the best beginner's texts IMHO.

Similar Messages

  • Referencing session variables in customMessages

    Can someone assist me with referencing session variables in a customMessage? For example, they following customMessage from productMessages.xml does not appear to work:
    <WebMessage name="kmsgProductPortal"><TEXT>Customer Dashboards - @{biServer.variables['NQ_SESSION.variable1']} </TEXT></WebMessage>
    Any help is appreciated.

    Can someone assist me with referencing session variables in a customMessage? For example, they following customMessage from productMessages.xml does not appear to work:
    <WebMessage name="kmsgProductPortal"><TEXT>Customer Dashboards - @{biServer.variables['NQ_SESSION.variable1']} </TEXT></WebMessage>
    Any help is appreciated.

  • Referencing a variable in 'session findbyId' command (SAP GUI Scripting)

    Hi all - I was wondering if anybody knew a way to get the following to work:
    I would like the script to type in a value in the components grid in SAP but I want ot put it in a loop so I can bump up the line number with each read. For it to work I would need a variable that I can control the contents of, such as the "Ct" (bolded-highlighted below):
    session.findById("wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT/ctxtRC29P-POSTP[1,Ct]").text = "n"
    However, when I run it it does not like it and stops there. Is there a way to make this happen?
    Cheers
    Umur

    Hi ScriptMan - Success!!  Your persistence is appreciated. Your approach is a smart way to build a script file from another script file and store the constructed code lines in there to be executed later.
    First I tried it and ran into an error from Windows Script Host:
    Script: c:\tmp\Script_Line.vbs
    Line: 15 (see below)
    Error: The control could not be found by id,
    Code:800A0268,
    Source: SAP Front end server.
    Line 15 it complained about was:
    session.findById("wnd[0]/usr/subSUB_ALL:SAPLCOIH:3001/ssubSUB_LEVEL:SAPLCOIH:1107/tabsTS_1100/tabpMUEB/ssubSUB_AUFTRAG:SAPLCOMK:3020/tblSAPLCOMKTCTRL_3020/ctxtRESBD-POSTP[6,1]").text = "n"
    Then I moved a few statements around and got rid of that error. Here's what I did based on your code:
    If Not IsObject(application) Then
       Set SapGuiAuto  = GetObject("SAPGUI")
       Set application = SapGuiAuto.GetScriptingEngine
    End If
    If Not IsObject(connection) Then
       Set connection = application.Children(0)
    End If
    If Not IsObject(session) Then
       Set session    = connection.Children(0)
    End If
    If IsObject(WScript) Then
       WScript.ConnectObject session,     "on"
       WScript.ConnectObject application, "on"
    End If
    Dim Ct
    session.findById("wnd[0]").maximize
    set Wshell = CreateObject("WScript.Shell")
    Set fso = CreateObject("Scripting.FileSystemObject")
    set TextFile = fso.CreateTextFile("c:\tmp\Script_Line.vbs", True)
    TextFile.WriteLine "If Not IsObject(application) Then"
    TextFile.WriteLine "Set SapGuiAuto = GetObject(" & chr(34) & "SAPGUI" & chr(34) & ")"
    TextFile.WriteLine "Set application = SapGuiAuto.GetScriptingEngine"
    TextFile.WriteLine "End If"
    TextFile.WriteLine "If Not IsObject(connection) Then"
    TextFile.WriteLine "Set connection = application.Children(0)"
    TextFile.WriteLine "End If"
    TextFile.WriteLine "If Not IsObject(session) Then"
    TextFile.WriteLine "Set session = connection.Children(0)"
    TextFile.WriteLine "End If"
    TextFile.WriteLine "If IsObject(WScript) Then"
    TextFile.WriteLine "WScript.ConnectObject session, " & chr(34) & "on" & chr(34)
    TextFile.WriteLine "WScript.ConnectObject application, " & chr(34) & "on" & chr(34)
    TextFile.WriteLine "End If"
    for Ct =0 to 16
    Script_Line = "session.findById(" & chr(34) & "wnd[0]/usr/subSUB_ALL:SAPLCOIH:3001/ssubSUB_LEVEL:SAPLCOIH:1107/tabsTS_1100/tabpMUEB/ssubSUB_AUFTRAG:SAPLCOMK:3020/tblSAPLCOMKTCTRL_3020/ctxtRESBD-POSTP[6," & int(Ct) &  "]" & chr(34) & ").text = " & chr(34) & "n" & chr(34)
    TextFile.WriteLine Script_Line
    next
    TextFile.Close
    wshell.run "c:\tmp\Script_Line.vbs", 1, true
    ScriptMan - you are really the ScriptMan! This opens doors for many other scripts where I can use this or a variation of this scheme.
    Thanks so much for taking the time and energy to get this to work. Much appreciated...

  • Referencing Global Variable in Forms DDL (Form Personalization R12)

    Team,
    I'm saving a profile option in a Global variable GLOBAL.FLINV_PROFILE_VALUE when a form opens.
    Then I am clearing the variable using Forms DDL and calling FND_PROFILE.SAVE function.
    I need to then reset the profile option with a second call to FND_PROFILE.SAVE. I'm trying to use Forms DDL, i.e.
    DECLARE
    a BOOLEAN;
    BEGIN
    a := fnd_profile.SAVE ('PER_SECURITY_PROFILE_ID'
    , '''||:global.flinv_profile_value||'''
    , ''USER''
    , ''1110''
    , NULL
    , NULL
    END;
    but I'm not finding a proper way to pass that global variable. Is there a way to reference these variables in the DDL? Should I use 'Call a procedure' and format the call differently?
    Any ideas are welcome.
    Joe

    Not sure why your using an anonymous block. Personalization rules should look like the following in a *.ldt file.
    BEGIN FND_FORM_CUSTOM_RULES "314"
    FUNCTION_NAME = "INV_INVITSNU"
    DESCRIPTION = "Disable Query-Enter Mode"
    TRIGGER_EVENT = "WHEN-NEW-BLOCK-INSTANCE"
    TRIGGER_OBJECT = "MTL_SERIAL_NUMBERS"
    SEQUENCE = "20"
    CREATED_BY = "34307"
    CREATION_DATE = "2012/04/22"
    OWNER = "USER123"
    LAST_UPDATE_DATE = "2012/04/22"
    LAST_UPDATE_LOGIN = "145888118"
    ENABLED = "Y"
    FIRE_IN_ENTER_QUERY = "N"
    FORM_NAME = "INVITSNU"
    RULE_TYPE = "A"
    BEGIN FND_FORM_CUSTOM_ACTIONS "314" "314"
    SEQUENCE = "10"
    PROPERTY_VALUE = "5"
    ARGUMENT_TYPE = "B"
    CREATED_BY = "34307"
    CREATION_DATE = "2012/04/22"
    OWNER = "USER123"
    LAST_UPDATE_DATE = "2012/04/22"
    LAST_UPDATE_LOGIN = "145888118"
    TARGET_OBJECT = "MTL_SERIAL_NUMBERS"
    ACTION_TYPE = "P"
    ENABLED = "Y"
    OBJECT_TYPE = "BLOCK"
    MESSAGE_TYPE = "S"
    BUILTIN_TYPE = "C"
    LANGUAGE = "*"
    PROPERTY_NAME = "195"
    MENU_SEPERATOR = "N"
    END FND_FORM_CUSTOM_ACTIONS
    BEGIN FND_FORM_CUSTOM_SCOPES "314" "20" ""
    LAST_UPDATE_DATE = "2012/04/22"
    OWNER = "USER123"
    CREATION_DATE = "2012/04/22"
    CREATED_BY = "34307"
    LAST_UPDATE_LOGIN = "145888118"
    END FND_FORM_CUSTOM_SCOPES
    END FND_FORM_CUSTOM_RULES

  • Issue with referencing Presentation variables(Date cols) in Case statement

    Hi,
    I m trying to reference presentation variables created on a Date column in the case statement of one of the request's columns as shown below:
    case when "- Quote Details"."Creation Date" between '@{from}{1999-1-1}' and '@{until}{2999-1-1}' then "- Quote Metrics"."# of Quotes" end
    I m getting a view display error with the below error message:
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 17001] Oracle Error code: 1861, message: ORA-01861: literal does not match format string at OCI call OCIStmtExecute
    SQL Issued: SELECT "- Quote Types"."Level2 Name" saw_0, case when "- Quote Details"."Creation Date" between '4/1/2009' and '4/15/2009' then "- Quote Metrics"."# of Quotes" end saw_1 FROM "(Unity) Quotes Catalog" WHERE "- Quote Details"."Creation Date" BETWEEN timestamp '2009-04-01 00:00:00' AND timestamp '2009-04-15 00:00:00' ORDER BY saw_0
    When I created the prompt on the date field I put the following formula in the prompt:
    cast("- Time".Day as DATE)
    When I apply a filter on the request using these variables it works fine.
    If anyone has faced this kind of issue earlier and have a resolution, please help me out.
    Thanks,
    Kartik

    Thanks Goran!!
    I've created prompts by selecting columns from the logical tables (i.e. I've selected 2 different cols of datatype DATE...inorder to assign 2 presentation variables).
    Yes I m using calendar widget for prompts.
    I haven't included any filter in my report. I m trying to display a metric when it satisfies the case statement.
    I will defintley go through the blogs you mentioned for better understanding.
    Thanks,
    Kartik
    Query fired on physical db:
    WITH
    SAWITH0 AS (select D1.c1 as c1,
    D1.c2 as c2,
    D1.c3 as c3,
    D1.c4 as c4,
    D1.c5 as c5
    from
    (select T192898.QLS_FIRST_ACAP_DT as c1,
    TO_DATE('3/2/2009','mm/dd/yyyy') as c2,
    TO_DATE('4/29/2009','mm/dd/yyyy') as c3,
    T188666.LEVEL2_NAME as c4,
    T188666.ID as c5,
    ROW_NUMBER() OVER (PARTITION BY T188666.ID, T192898.QLS_FIRST_ACAP_DT ORDER BY T188666.ID ASC, T192898.QLS_FIRST_ACAP_DT ASC) as c6
    from
    XXSLS_GBL_QTE_TYPES_V T188666,
    XXSLS_GBL_QTE_DTL_F T192898
    where ( T188666.ID = T192898.QUOTE_TYPE_ID )
    ) D1
    where ( D1.c6 = 1 ) ),
    SAWITH1 AS (select D1.c1 as c1,
    D1.c2 as c2,
    D1.c3 as c3
    from
    (select count(distinct T192898.QUOTE_HEADER_ID) as c1,
    T188666.LEVEL2_NAME as c2,
    T188666.ID as c3,
    ROW_NUMBER() OVER (PARTITION BY T188666.ID ORDER BY T188666.ID ASC) as c4
    from
    XXSLS_GBL_QTE_TYPES_V T188666,
    XXSLS_GBL_QTE_DTL_F T192898
    where ( T188666.ID = T192898.QUOTE_TYPE_ID )
    group by T188666.ID, T188666.LEVEL2_NAME
    ) D1
    where ( D1.c4 = 1 ) ),
    SAWITH2 AS (select D1.c1 as c1,
    D1.c2 as c2,
    D1.c3 as c3
    from
    (select case when SAWITH1.c2 is not null then SAWITH1.c2 when SAWITH0.c4 is not null then SAWITH0.c4 end as c1,
    case when SAWITH0.c1 between SAWITH0.c2 and SAWITH0.c3 then SAWITH1.c1 else NULL end as c2,
    case when SAWITH0.c5 is not null then SAWITH0.c5 when SAWITH1.c3 is not null then SAWITH1.c3 end as c3,
    ROW_NUMBER() OVER (PARTITION BY case when SAWITH0.c5 is not null then SAWITH0.c5 when SAWITH1.c3 is not null then SAWITH1.c3 end , case when SAWITH1.c2 is not null then SAWITH1.c2 when SAWITH0.c4 is not null then SAWITH0.c4 end ORDER BY case when SAWITH0.c5 is not null then SAWITH0.c5 when SAWITH1.c3 is not null then SAWITH1.c3 end ASC, case when SAWITH1.c2 is not null then SAWITH1.c2 when SAWITH0.c4 is not null then SAWITH0.c4 end ASC) as c4
    from
    SAWITH0 full outer join SAWITH1 On SAWITH0.c5 = SAWITH1.c3
    ) D1
    where ( D1.c4 = 1 ) )
    select SAWITH2.c1 as c1,
    SAWITH2.c2 as c2
    from
    SAWITH2
    order by c1

  • Referencing a Variable When Calling a Function

    I want to use a variable I have created when I call a certain function. It appears that I may be going about it the wrong away. Can someone take a look at this and tell me if it's possible or maybe how to achieve the result I'm trying for? It would be nice to use the variable anywhere in my whole script besides just inside a certain block.
    This is my code:
    DECLARE
    continuing_term varchar2(6);
    BEGIN
        SELECT MIN(sgbstdn_term_code_eff)
        INTO continuing_term
        FROM sgbstdn
        WHERE sgbstdn_pidm = '216520'
        AND sgbstdn_styp_code = 'C'
        AND sgbstdn_stst_code = 'AS';
        SELECT substr(f_concat_as_of_cum_gpa('216520', continuing_term ,'UG','I'),14,3) FROM dual;
    END;
    /I'm getting the error that an into clause is expected at the second SELECT statement.

    blackhole82 wrote:
    I want to use a variable I have created when I call a certain function. It appears that I may be going about it the wrong away. Can someone take a look at this and tell me if it's possible or maybe how to achieve the result I'm trying for? It would be nice to use the variable anywhere in my whole script besides just inside a certain block.Can you tell us what is the result you're trying for?
    If it's just setting a variable, then a bind variable may be the easiest thing.
    Use the PL/SQL VARIABLE commnad to define a bind variable, such as gpa_code.
    After it is defined, the varibale can be used in SQL statements of PL/SQL, as :gpa_code, prefixed with a colon.
    For example:
    VARIABLE  gpa_code  VARCHAR2 (3);
    BEGIN
        SELECT SUBSTR ( f_concat_as_of_cum_gpa ( 216520
                                                , MIN(sgbstdn_term_code_eff)
                                                , 'UG'
                                                , 'I'
                      , 14
                      , 3
        INTO :gpa_code
        FROM sgbstdn
        WHERE sgbstdn_pidm = '216520'
        AND sgbstdn_styp_code = 'C'
        AND sgbstdn_stst_code = 'AS';
    END;
    SELECT  *
    FROM    some_other_table
    WHERE   column_a = :gpa_code;As Tubby mentioned earlier, making this a function rather than an anonymous block would probably be a good idea.
    Then you could say
    SELECT  *
    FROM    some_other_table
    WHERE   column_a = get_gpa_code;or
    SELECT  *
    FROM    some_other_table
    WHERE   column_a = get_gpa_code (216520, 'C', 'UG');
    This is my code:
    DECLARE
    continuing_term varchar2(6);
    BEGIN
    SELECT MIN(sgbstdn_term_code_eff)
    INTO continuing_term
    FROM sgbstdn
    WHERE sgbstdn_pidm = '216520'
    AND sgbstdn_styp_code = 'C'
    AND sgbstdn_stst_code = 'AS';
    SELECT substr(f_concat_as_of_cum_gpa('216520', continuing_term ,'UG','I'),14,3) FROM dual;
    END;
    /I'm getting the error that an into clause is expected at the second SELECT statement.The immediate problem is that you need an INTO clause, like you have in the first query.
    You don't need two queries. See the bind variable illustration above.
    Edited by: Frank Kulash on Nov 7, 2008 11:41 AM

  • Referencing "Form Variables" in Formcalc

    WIth LiveCycle Designer ES4 I'm trying to place a group of string variables used throughout my form so as not to have to edit the same variables in several places.
    I don't want to use Form Properties>Variables because one can't see the entire group at once. In other words, there are variables that need to be located next to subordinate variables for a clearer picture and to prevent errors, i.e. var propertyOwner, var propertyTract, var propertyTelephone.
    Under variables in the form hierarchy, I inserted a "Script Object" folder and named it "Owners". In that folder I entered all of the mentioned variables. The folder/object name is "TwentyTwoHills.#variables[0].Owners". The first variable is
    var TTHOwner1 = "Joe Smith";
    How can I reference this variable to be used to load a drop down box in my form with FormCalc?
    Any help appreciated,
    Thanks,
    Fred

    Hi,
    in script objects you only can use JavaScript syntax, FormCalc in not supported by these objects at all.
    As you also cannot call an JavaScript action from a FormCalc event.
    You'll have to use JavaScript in all scenarios you're using the script objects.
    Here's a sample how to do this.
    Create a function in your script object, that contains some nested arrays.
    Each array contains two values, the first represents the name the second the value.
    Through the forEach method you can simply filter the arrays.
    function loadValue (vValue){
      var aVars = [
      ["varA", "Lorem"],
      ["varB", "Ipsum"],
      ["varC", "Dolor"]
      vReturn;
      aVars.forEach(function (element, index) {
      if (element[0] == vValue) {
      vReturn = element[1];
      return vReturn;
    Retrieve the value from array "varA" use this function.
    Owners.loadValue ("varA");

  • Referencing Package Variables

    Running Forms 6i and Oracle 8.1.6
    Can you reference server side package variables directly from Forms, or do you still have to write a wrapper procedures to "set" and "get" them.
    CREATE OR REPLACE package test_pkg as
    v_pkgvar varchar2(10) := 'TEST';
    TYPE r_emp_rec IS RECORD
    (empno emp.empno%TYPE,
         ename emp.ename%TYPE,
         mgr emp.mgr%TYPE,
         deptno emp.deptno%TYPE,
         dname dept.dname%TYPE,
         loc dept.loc%TYPE
    TYPE t_emp_rec IS TABLE OF r_emp_rec INDEX BY BINARY_INTEGER;
    end;
    DECLARE
    data_blk test_pkg.t_emp_rec;
    v_test varchar2(100) := test_pkg.v_pkg_var;
    BEGIN
    null;
    END;
    It seems funny that i can reference test_pkg.t_emp_rec;
    but not test_pkg.v_pkg_var;
    Thanks for your help

    You have to use wrapper setters and getters to reference package variables on Server side PL/SQL from client side PL/SQL (Forms) this will not change no matter what the versions concerned

  • Referencing WSDL Variables

    Hello,
    I'm learning how to use wsdl in my code and need to do an
    api to it. I got some questions and hopefully someone can help me
    out or point me to so way.
    The wsdl def is
    http://voyager3.expedata.net/ExpeData_DAWS/DAWS.asmx?WSDL
    I'm able to authenticateuser, but when I try to start a
    session. I'm being to it will ref some variables. Not sure how to
    get the value of these variables. This is what I have so far. Any
    help would be greatly appreciated.
    Jimmy
    <CFSET Profile = structNew()>
    <CFSET Profile.Userid = "username">
    <CFSET Profile.Password = "password">
    <CFSET Profile.BatchID = "">
    <CFSET Profile.SessionID = "">
    <CFSET Profile.ErrorCode = "">
    <CFSET Profile.ErrorMsg = "">
    <cfinvoke
    webservice="
    http://voyager3.expedata.net/ExpeData_DAWS/DAWS.asmx?WSDL"
    method="authenticateUser"
    returnvariable="authenticateUserRet">
    <cfinvokeargument name="userid"
    value="#Profile.UserID#"/>
    <cfinvokeargument name="password"
    value="#Profile.Password#"/>
    <cfinvokeargument name="errorcode"
    value="enter_value_here"/>
    </cfinvoke>
    <CFOUTPUT>#authenticateUserRet#
    #Profile.Errorcode#</CFOUTPUT><br />
    <br />
    <cfdump var="#authenticateUserRet#"/>
    <cfinvoke
    webservice="
    http://voyager3.expedata.net/ExpeData_DAWS/DAWS.asmx?WSDL"
    method="startSession"
    returnvariable="startSessionRet">
    <cfinvokeargument name="password"
    value="#Profile.Password#"/>
    <cfinvokeargument name="userid"
    value="#Profile.UserID#"/>
    <cfinvokeargument name="batchID"
    value="#Profile.batchid#"/>
    <cfinvokeargument name="errorMsg"
    value="{profile.errormsg}"/>
    <cfinvokeargument name="sessionID"
    value="#Profile.sessionid#"/>
    </cfinvoke>
    <cfdump var="#startSessionRet#"/>
    <CFOUTPUT>#startSessionRet#</CFOUTPUT>

    You have to use wrapper setters and getters to reference package variables on Server side PL/SQL from client side PL/SQL (Forms) this will not change no matter what the versions concerned

  • Problem referencing item variables

    I have a few items in my app, BOOK_FROM BOOK_LENGTH BUILDING
    when I reference them in a report query as
    :BOOK_FROM :BOOK_LENGTH :BUILDING everything works
    fine, but when I try to reference them in some
    html region as &BOOK_FROM. &BOOK_LENGTH. &BUILDING.
    only &BUILDING. is displayed.... they all look perfecly
    similar to me.
    Any common pitfall I'm failing to see here?
    Thanks in advance for the help

    Kuy,
    If you reference them in an HTML region in a section of the page that is rendered before the items are rendered, they may not yet have values. The one that does work might have obtained a value from a previous page view or in a different way. It's not possible to give more definitive information without seeing your app.
    Scott

  • What is the difference between variable and Define

    WHAT IS THE DIFFERENCE BETWEEN
    these different declarations when it is done using the keyword "variable" and "define"
    and both of these are done OUTSIDE "DECLARE"
    VARIABLE g_monthly_sal NUMBER
    DEFINE p_annual_sal =5000
    -- I understand that p_annual_sal will be taken as a CHAR.
    -- ALSO IF DEFINE variable acts as macro variable, SO is it necessary to give it some value whenever we define it.
    if not what value would be substituted for it?
    OR does that mean whenever we want to specify data type for a bind varible we should use VARIABLE and
    when we do not want to specify type we use DEFINE?
    THANK YOU
    Edited by: user6287828 on Feb 24, 2009 11:03 AM
    Edited by: user6287828 on Feb 24, 2009 11:04 AM

    Both are SQL*plus commands. In a real programming environment you will not use such constructs (except a few rare scripting cases).
    The difference is how the construct is later used. DEFINE is more like a copy&paste string. Whereever the name of this substitution variable is found it will be pasted into the sql*plus session.
    VARIABLE creates a real variable. You can change the value and if follwos the usual principles of variables (including binding).
    Example can be found the docs:
    from the docs
    Where and How to Use Substitution Variables
    You can use substitution variables anywhere in SQL and SQL*Plus commands, except as the first word entered. When SQL*Plus encounters an undefined substitution variable in a command, SQL*Plus prompts you for the value.
    You can enter any string at the prompt, even one containing blanks and punctuation. If the SQL command containing the reference should have quote marks around the variable and you do not include them there, the user must include the quotes when prompted.
    SQL*Plus reads your response from the keyboard, even if you have redirected terminal input or output to a file. If a terminal is not available (if, for example, you run the script in batch mode), SQL*Plus uses the redirected file.
    After you enter a value at the prompt, SQL*Plus lists the line containing the substitution variable twice: once before substituting the value you enter and once after substitution. You can suppress this listing by setting the SET command variable VERIFY to OFF.
    Using Bind Variables
    Bind variables are variables you create in SQL*Plus and then reference in PL/SQL or SQL. If you create a bind variable in SQL*Plus, you can use the variable as you would a declared variable in your PL/SQL subprogram and then access the variable from SQL*Plus. You can use bind variables for such things as storing return codes or debugging your PL/SQL subprograms.
    Because bind variables are recognized by SQL*Plus, you can display their values in SQL*Plus or reference them in PL/SQL subprograms that you run in SQL*Plus.
    Creating Bind Variables
    You create bind variables in SQL*Plus with the VARIABLE command. For example
    VARIABLE ret_val NUMBER
    This command creates a bind variable named ret_val with a datatype of NUMBER. See the VARIABLE command for more information. (To list all bind variables created in a session, type VARIABLE without any arguments.)
    Referencing Bind Variables
    You reference bind variables in PL/SQL by typing a colon (:) followed immediately by the name of the variable. For example
    :ret_val := 1;
    To change this bind variable in SQL*Plus, you must enter a PL/SQL block. For example:
    BEGIN
    :ret_val:=4;
    END;
    /

  • Why should you explicitly open and close shared variable connections?

    I'm looking into switching over from the old Datasocket API to the new Shared Variable API for programmatic access to shared variables, and I noticed that LV doesn't seem to have any problems executing Shared Variable Reads & Writes without first opening the connection explicitly. That is, I can just drop in a shared varaible Read VI, wire a constant to the refnum input, and it will work. I'm wondering, then, what benefits are offered by explicitly opening the conenction ahead of time...?
    I guess I could see some cases where you want to open all necessary connections in an initialization state of a top-level state machine, particularly if you want to use the "Open & Verify Connection"---so you could jump straight to an error case if any connections fail. But other than that, why else might one want to explicitly open the connections.
    And, along those lines, are there any problems with implicitly opening the connections? One reason why I am hesitant to open them explicitly is because for one of our applications, we need to be able to dynamically switch from one variable to another at runtime. It would be nice to just switch the variable refnum (wired to the input of the Read function), without having to manually close out the old connection and open a new one. A quick prototype of this seems to work. But am I shooting myself in the foot by doing so?
    Thanks in advance.

    I'd expect there's a very small number of people at NI that would know the answer to the detail you're asking for.  But, let's try to extrapolate from this rather old post to see if we can understand what they're forming their impression on.
    The shared variable has to have some sort of reference going on in the background.  It looks like they're calling this a connection.  It's how LabVIEW knows where to find this variable on the network.  We can also see this reference certainly exists if we're opening/closing the reference in the explicit method.  You see the connection as just a string referencing the variable by URL.  This "reference" has to be stored somewhere.  No matter how we're looking at this, we're aware there's a reference of some sort stored. 
    Now, we'd want to look at what would cause this reference to go away.  If you open/close explicitly, it's easy to see it goes away at the close.  If it's implicit, when would it make sense to close it out?  The VI can't be expected to guess where it's done being referenced and close it out.  This puts us into a situation where the soonest it could close is when the VI ends.  From my experience, references tend to be wiped when you close out LabVIEW.  It's this kind of idea that makes the FGV possible.  I wouldn't be surprised by Morgan's claim here.
    If we look at scalability, you're talking about two different topics.  You're talking about adding an extra open, close, read, etc rather than just a few wires.  That certainly would look a mess.  In terms of the dynamic swap that was being discussed, we wouldn't be adding all of those.  The concern would be if enough connections were opened it'd start to behave similar to a memory leak.  This could be something that works with a smaller number of variables.  If you continue to scale, it becomes problematic.  This is why they suggest it's not scalable. 
    To your questions:
    Does LV allocate some kind of session in memory using that string as a lookup?
    It would HAVE to allocate some memory to hold that string.  Otherwise, it'd be pointless to even have the reference. 
    Does it reuse that session if other parts of the application reference the same variable, or does it create a unique session for each referencing call to "Read Variable.vi"?
    I would expect this to be "it depends."  With the implicit method, I would expect it to open a new reference in each point it isn't wired.  This is similar to int x,y = 5;  x and y share the same value but are their own unique memory location.  If you wire the reference to the other points, it should use the same reference.  This would make more sense to me than the program seeking out any other potential usage of the variable in the application to see if there's already a reference open.  I could be wrong, though.
    And what resources does this "connection" actually represent?
    At best, this is just the string.  At worst, it's the string and the TCP socket.  I'd lean towards the first.  Opening and closing sockets should be relatively easy in most applications.  But, it also wouldn't surprise me if it holds the socket.
    I'm sure others have a better understanding than I do.  But, that's what I'd expect for anything you've asked.

  • Show the period value in column header using Text Variable

    We are using Posting Period & Financial Year to calculate YTD & MTD, for current year and previous years. These posting period and financial year characteristics are custom created characteristics we are using due to customer specific requirement.
    Input values are posting period, financial year and numeric value. To calculate previous year, I need to subtract numeric value from the input financial year. Every thing is working fine up to this.
    In the report I need to show the posting period and financial year values dynamically in each column header of the report for MTD, YTD for current year & previous year. I tried to achieve this using Text Variables, but I didn’t succeed. If some one can give me some idea to resolve this, it would be very helpful.
    I am excellent in ABAP coding. If you can specify me to code in User Exit, I can do it.
    Column headers should be 08.1999 Sales Qty, 08.2008 Sales Qty, 1999 Sales Qty, 2008 Sales Qty.

    Hi Abhinav,
    Try using the content text variables 0T_FYEAR and 0T_FPER3, when used in the head these variable should display the year and period specified in the RKF.
    e.g
    &0T_FPER3&. &0T_FYEAR& Sales Qty = 08.1999 Sales Qty
    If that doesnt work, try creating text replacement path variables referencing the variables you created for the year and period input. To do this click on the RKF and click on the dropdown by the yellow box next to the description on the general tab and select New Variable, enter the description, tech name and set processng by to Replacment Path, then select period as the ref. characteristic, then on the replacement path tab change replace variable with to variable and then select the variable you are using for the period input, save then hit ok, this is now a text representation of the variable your are inputing for period and can be used in the column headers, you will need to repeat the process for the fiscal year.
    Hope this helps
    Josh

  • Variable calc.FiscalYearSumconservativeBudget is undefined.

    Hi,
    I have created a report with two groups: Manager and FiscalYear. The Report Builder generated all calculated variables.
    I can display totals on the Manager level. However when I try to display a sum of ConservativeBudget in the FiscalYear footer, I have this error:
    Variable  calc.FiscalYearSumconservativeBudget is undefined.
    The  error occurred in D:\sites\invivoteipo.com\reports\forecastingDetails.cfm:  line 18
    16 :
    17 : <cfreport format="pdf" template="ForecastingDetails.cfr" query="#CFReportDataQuery#">
    18 :      <cfreportparam name="FiscalYear" value="#FiscalYear#">
    19 : </cfreport>     
    I have tried to create this calculated variable myself, with the same results. If I drag this field to the FiscalYear header, I have no errors and I can see 0 as the value.
    Any idea what is going on?
    Thank you in advance.
    JK

    <CFQUERY name="cr" datasource="sire" dbtype="odbc">
      SELECT page_id
      FROM  sire.dbo.CORNER_REPORTS_Page
      WHERE page_id = <cfqueryPARAM value = "#page_id#"     <!--- Here you're referencing #page_id#, which hasn't been set anywhere
                                          CFSQLType = 'CF_SQL_INTEGER'>
    </cfquery>
    In the query, you're referencing a variable called page_id, but you haven't set that anywhere. Did you mean to use #url.corner#? You have a URL variable in there which looks suspiciously like it's there for a reason
    There's then no reason to set the result to anything afterwards, you can just reference the variable using queryname.columnname (assuming it only returns one row) - ie:
    <cfoutput>#cr.page_id</cfoutput>
    Hope that halps a little.

  • Session variable in the title

    I want to add my session variable in the title.
    I used the following:
    @{biServer.variables['NQ_SESSION.myvariable']}
    and I got the default session variable value and not the current one.
    I know about the way to add column and use it in narrative text, but I want it in the title.
    Can someone please assist?

    Look into these http://obiee101.blogspot.com/2008/02/obiee-adding-session-variables-to.html
    http://obiee101.blogspot.com/2007/12/obiee-referencing-session-variables-in.html
    Display Session Variable in Title View
    hope answered.
    Cheers,
    KK

Maybe you are looking for