Returns to old value!

Hi again guys.
Is there anyway that a global variable can keep its value assigned in a method,after the program leaves the class?
Let me give U an example!
class one
int x = null;//Global
void method()
x = 3;
void method2()
system.out.println(x);
class two
calls method2
Class two is called with a Button is pressed.My probelm is that x has returned to null when I return from class two
,but I need it to be 3!

LOL
That is not my code,just showing U what I mean.(Somewhere between an algorithm,and pseudo-code)
Below is part of the real code(Not promising it is any better!!!)
When the button in the Jframe is click button is called,which in turn calls incI().What I need is g3 to hold the value of g2,not of null.
Graphics2D g3 = null;
public void paintComponent(Graphics g)
addMouseListener(this);
addMouseMotionListener(this);
     super.paintComponent(g);
Graphics2D g2 = (Graphics2D) g;
     g3 = g2;
drawArc(0, g3);
void incI(int s)
     i++;
     drawArc(0, g3);
class Button extends JPanel
public Button(MyPanel inGraphPanel)
final MyPanel graphPanel = inGraphPanel;
JButton plusButton = new JButton(" + ");
JButton minusButton = new JButton(" - ");
JFrame frame = new JFrame("Frame");
Container cp = frame.getContentPane();
plusButton.addActionListener(new ActionListener()
public void actionPerformed(ActionEvent ce)
     graphPanel.incI();
minusButton.addActionListener(new ActionListener()
public void actionPerformed(ActionEvent ce)
cp.setLayout(new FlowLayout());
add(plusButton);
add(minusButton);
}

Similar Messages

  • Return Into.  Can I return the old value in an update statement?

    Hello - I have an update statement and I need the value of a field, prior to the update. Is it possible to use the Return Into to do this? Or do I have to have a separate select statement prior to the update statement in order to store that value in a variable?
    Thanks!

    RETURNING INTO is valid for an UPDATE, but it returns the new value, not the old value.
    SCOTT @ nx102 Local> select * from a;
          COL1
             4
    Elapsed: 00:00:00.00
    SCOTT @ nx102 Local> ed
    Wrote file afiedt.buf
      1  declare
      2    l_old_col1 number;
      3  begin
      4    update a
      5       set col1=col1+1
      6     returning col1 into l_old_col1;
      7    dbms_output.put_line( l_old_col1 );
      8* end;
    SCOTT @ nx102 Local> /
    5
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.00If you are trying to track historical changes, have you looked at Workspace Manager? That can be far easier than writing your own change tracking code...
    Justin

  • Web service returns old values

    Hallo, 
    by using web service my project is remotely controled. The mapping data will be transferred using the shared variables.
    The shared variables work perfectly, but the responce on the xml page (outputs: web_master_resp, web_scene_resp, web_action_resp and error code) always returns the old values which happened at the last url activity.
    For instance, after sending "http://localhost:8080/webcontrol/scene/action" and following "http://localhost:8080/webcontrol/scene_1/action_1" the xml returns "scene" on "web_scene_resp"  and "action" on "web_action_resp"
    what should i do to get the lastest values read?

    hi,
    just a guess: I'd try to use I instead of NUMC for the document numbers.
    NUMC is no number but a character string with numeric characters only. only some display routines in SAP know that this string of numerals represents a number and omit leading zeroes.
    my 2 cents,
    anton

  • Delete after trigger returns a NULL value for the old primary key??

    I am creat an After trigger that I was using to delete a row from another table. However, the OLD value returned for my primary key is a NULL value. I have an UPDATE and an INSERT portion to this same trigger that work fine with just grabbing NEW values, but this OLD value cannot be grabbed for some reason, although it seems to work on other tables when the owner is me, the problem table is not owned by me though. Has anyone run into this before? Is there a view that I need access to from this table or perhaps a setting I need to turn on? I am at a loss. Thanks.

    Cannot reproduce with this modified trigger code … right now I believe the problem is in this part:
    BEGIN
      col_ret := vpack.vOPCollectIO(tpid, User, 'SCOTT.OINFTABL', dmltype, vdata);
    EXCEPTION
      WHEN lost_connection OR lost_connection2 THEN
        col_ret := vpack.vOPCollectIO(tpid, User, 'SCOTT.OINFTABL', dmltype, vdata);
    END;
    In schema CORE:
    SQL> create table oinftabl
      2  ( akey     number(9) primary key
      3   ,astring  varchar2(10)
      4   ,astring2 varchar2(10)
      5  );
    Table created.
    SQL>
    SQL> grant all on oinftabl to flip;
    In schema FLIP (which has “CREATE ANY TRIGGER”):
    flip@FLOP> CREATE OR REPLACE TYPE VDAT AS VARRAY(100000) OF VARCHAR2(50);
    2     /
    create or replace trigger sbt3_system_oinftabl_x
    after insert or update or delete on core.oinftabl
    REFERENCING NEW as n OLD as o
    FOR EACH ROW
    DECLARE
      col_ret INT;
      dmltype CHAR(1);
      tpid VARCHAR2(30);
      vdata VDAT; --varray datatype I created;
      lost_connection EXCEPTION;
      lost_connection2 EXCEPTION;
      already_there EXCEPTION;
      PRAGMA EXCEPTION_INIT(lost_connection, -28576);
      PRAGMA EXCEPTION_INIT(lost_connection2, -28579);
      PRAGMA EXCEPTION_INIT(already_there,-1);
    BEGIN
      tpid := SYS.DBMS_TRANSACTION.LOCAL_TRANSACTION_ID();
      IF INSERTING THEN dmltype := 'I';
      ELSIF UPDATING THEN dmltype := 'U';
      ELSE dmltype := 'D';
      END IF;
      IF INSERTING OR UPDATING THEN
        dbms_output.put_line('new akey='||nvl(to_char(:n.akey),'null'));
        dbms_output.put_line('new astring='||:n.astring);
        vdata := VDAT(
        to_char(:n.AKEY),
        :n.ASTRING,
        :n.ASTRING2,
        NULL);
      ELSIF DELETING THEN
        dbms_output.put_line('old akey='||nvl(to_char(:o.akey),'null'));
        vdata := VDAT(
          to_char(:o.AKEY),
          NULL);
      END IF;
      for i in 1..vdata.count
      loop
        dbms_output.put_line('vdata('||i||')='||nvl(vdata(i),'null'));
      end loop;
    --BEGIN
    --  col_ret := vpack.vOPCollectIO(tpid, User, 'SCOTT.OINFTABL', dmltype, vdata);
    --EXCEPTION
    --  WHEN lost_connection OR lost_connection2 THEN
    --    col_ret := vpack.vOPCollectIO(tpid, User, 'SCOTT.OINFTABL', dmltype, vdata);
    --END;
    END;
    Trigger created.
    flip@FLOP> show errors
    No errors.
    flip@FLOP> insert into core.oinftabl values (1,'abc',null);
    new akey=1
    new astring=abc
    vdata(1)=1
    vdata(2)=abc
    vdata(3)=null
    vdata(4)=null
    1 row created.
    flip@FLOP>  update core.oinftabl set akey=2, astring='cba' where akey=1;
    new akey=2
    new astring=cba
    vdata(1)=2
    vdata(2)=cba
    vdata(3)=null
    vdata(4)=null
    1 row updated.
    flip@FLOP> delete from core.oinftabl where akey=2;
    old akey=2
    vdata(1)=2
    vdata(2)=null
    1 row deleted.
    So the trigger has the OLD AKEY value when DELETING and it does successfully store it in the VARRAY.
    Hence the problem is in that pl/sql block at the end.
    What are you doing in there?

  • How to retrieving attributes old values from a OBJECT_CHANGED event

    Hi,
    I have installed Sun ONE Directory Server 5.2. I have registared Event Listener which implements both name space change and object change interfaces. After chaning some attribute value, i am able to get the new values of attributes using getNewBinging method. But when i call getOldBinding to get attributes, it is returning null. Can any one help me how to get the old values. This is very much urgent and we are trying to write custom connectors to synchronize the data in Sun ONE directory server with other directory servers like Oracle Internet Directory.
    I am new to Java and JNDI.
    It would be great help if any one can light me in this regard. Thanks in advance.
    Thanks & Regards
    Sreedhar

    I have been also working for the same issue. getOldBinding() does not return old attributes in case of ObjectChanged event. So far I did not find any solution. Does anyone know any solution?

  • FM returns wrong total value for Limit type PO's

    Hi all,
    I am working on SRM 5.0 (SP13) ECS.
    I have implemented the BADI "BBP_WFL_APPROVAL_BADI" for determining the Approvers for PO whenevr a PO is changed.If the diference between the Old PO value and new PO value is > 1000 and the approval text field(custom text under "Documents" link) is set to "YES",then the WF approval is required and the approvers are determined.
    The above logic works fine for the Standard type PO's where the difference between the old value and new value is determined using FM "BBP_PD_PO_GETDETAIL"  by passing the GUID (for the change version and the active vesion) obtained at runtime in the BADI.
    However for the limit type PO's,whenevr I change the total value for the Limit item,I see that the FM "BBP_PD_PO_GETDETAIL" doesnt return the changed value but  always returns blank!
    Bcause I need to check bth the values i.e. Custom text set to "YES" as well as Total value diff ,I cant use the start conditions in tcode SWB_COND.ALso I need to fetch the approvers based on the price diff so I need this value at runtime in the BADI using the FM "BBP_PD_PO_GETDETAIL".
    Please advise why the FM is not returning the changed values for the Limit type PO and is there any other way(other table/FM) to get the changed value at runtime for the LIMIT type PO.
    Thanks for your time.
    Edited by: Rads1234 on Nov 18, 2010 4:39 AM

    Thanks for the rpely.
    Yes.I am using the GUID available at runtime in the  BADI "BBP_WFL_APPROV_BADI" which is the current change version GUID.I tried using that GUID to get the data from both FM as well as CDHDR and CDPOS tables.
    I think this is something related to LImit type PO because for Standard type PO's the FM returns the corretc changed value (as in the screen) for the change version GUID.I fail to understand why the changed values are shwon on the screen but are not stored anywhere in the system before actually ordering the PO!

  • How to get the old value of the ValueChangeEvent

    I'm using the JSF component selectManyListbox. I have assigned a value change listener to it. When I try get the old value using getOldValue() of the ValueChangeEvent Im always getting a null value. The only value Im getting is from the method getNewValue(), which is the last item I clicked in the selectManyListbox items before submitting the whole form. Is there a way to get the old value of this component or Im doing something wrong?

    Here is the partial bean code
    public class TestUI extends PageCodeBase {
         private static Logger logger = Logger.getLogger(pagecode.protected1.TestUI.class);
         protected Object [] menuValue;
         protected Object [] listBoxValue;
         protected List allTaskCodes;
         * @return Returns the listBoxValue.
         public Object[] getListBoxValue() {
              return listBoxValue;
         * @param listBoxValue The listBoxValue to set.
         public void setListBoxValue(Object[] listBoxValue) {
              this.listBoxValue = listBoxValue;
    public void handleSelectManyListboxValueChange(
                   ValueChangeEvent vce) {
              logger.debug(".. first component was heard..");
              String[] s1 = (String[]) vce.getOldValue();
              String[] s2 = (String[]) vce.getNewValue();
              //vce.getComponent().
              if (s1!=null&&s1.length!=0) {
                   logger.debug("length of first array is " + s1.length );
              //for(int i=0; i<s1.length; i++)
                        logger.debug("value of old is " + s1[0] );
              if (s2!=null&&s2.length!=0) {
                   logger.debug("length of second array is " + s2.length );
                   //for(int i=0; i<s1.length; i++)
                        logger.debug("value of new is " + s2[0]);
    Here is the jsf code
    <h:selectManyListbox styleClass="selectManyListbox" id="listbox1"
                        size="3" valueChangeListener="#{pc_TestUI.handleSelectManyListboxValueChange}"
    onchange="submit()" value="#{pc_TestUI.listBoxValue}">
    <f:selectItem itemValue="value1" itemLabel="select1" />
                        <f:selectItem itemValue="Value2" itemLabel="select2" />
                        <f:selectItem itemValue="Value3" itemLabel="select3" />
    <f:selectItem itemValue="value4" itemLabel="select1" />
                        <f:selectItem itemValue="Value5" itemLabel="select2" />
                   </h:selectManyListbox>

  • Seeing Old Values when trying to validate in Extended EO

    Hi,
    I have created an EO Extension (and substitution) to PoRequisitionLineEO, and am attempting to perform validation on several elements in the page (category ID, attribute2, attribute3). Basically, I analyze these elements in the ValidateEntity() method, and throw an error if they do not satisfy business requirements.
    As long as I keep entering good data into the NonCatalog Request Page, everything performs as expected...however, after I enter the first bad set of data, my exception is thrown properly, but I can no longer save the record, regardless of whether the data passes validation.
    After inserting some println statements, I've discovered that the values I'm looking for (i.e. getAttribute2() ) hold their old value from the error. In other words, the getters keep returning the value that caused the failure, and never reflect the new value that I put into the field.
    I suspect that I am doing something incorrectly while throwing the error. Here's the code I use to create the error. Is this an acceptable way to stop a record from saving using EO validation? Or is there something else I'm doing wrong.
    throw new OAAttrValException(OAException.TYP_ENTITY_OBJECT,
    getEntityDef().getFullName(), // EO name
    getPrimaryKey(), // EO PK
    null, // Attribute Name
    null, // Attribute value
    "XX", // Message product short name
    "XXI_PO_AFE_REQUIRED");
    Any help is greatly appreciated.
    thanx,
    bw

    Remove the EM database file as described here:
    https://forums.adobe.com/thread/1517855?q=guideguide
    It worked for me!

  • Delete old value of primary key for an UPDATE LCR

    Hi,
    I have a transformation attached to a add_global_propagation_rules, this transformation modify the command_type of every LCR to be an INSERT instead of their original command.
    The old values are switched to new values array for the DELETE LCR. For the UPDATE, the old values are also removed, but when I try to remove the old value of the primary key column....the new values is also deleted!
    Is it normal ? I searched in the doc to see special behavior of the delete_column for the primary key, but I saw nothing.
    When the new value is delete, this line is executed :
    lv_lcr.delete_column(lv_col.column_name, 'old');
    Thanks.

    Hi Sean
    Thanks for you answer.
    Yes, I track the DML activities, but due to hardware restriction, we have to keep the load as possible on the server source.
    Here is the source of the transform function. In this version, for the UPDATE LCR, the PK are recreated.
    Thanks
    FUNCTION transform(lcr IN anydata)
    RETURN anydata
    IS
    lv_isProp NUMBER(1);
    lv_lcr SYS.Lcr$_Row_Record;
    lv_rc PLS_INTEGER;
    lv_cols SYS.LCR$_ROW_LIST;
    lv_cols_new SYS.LCR$_ROW_LIST;
    lv_cols_old SYS.LCR$_ROW_LIST;
    lv_col SYS.LCR$_ROW_UNIT;
    lv_dest gtr_destination_typ;
    lv_source gtr_sourceInfo_typ;
    lv_addCols gt_colInfList_typ;
    i NUMBER;
    r PLS_INTEGER;
    lv_isUPDATE BOOLEAN;
    lv_pkValues gt_value_by_colName;
    lv_next VARCHAR2(30);
    BEGIN
    -- Access the LCR
    lv_rc := lcr.GETOBJECT(lv_lcr);
    --get source
    lv_source := gv_sourceInfo(lv_lcr.get_object_owner||gv_connector||lv_lcr.get_source_database_name);
    --get destination
    lv_dest := lv_source.destination;
    --Loop through column to remove columns not propagated
    --when the action is a DELETE, use the array of OLD values
    IF lv_lcr.get_command_type = 'DELETE' THEN
    lv_cols := lv_lcr.get_values('old');
    --when the action is an INSERT or an UPDATE, use the array of NEW values
    ELSE
    lv_cols := lv_lcr.get_values('new', 'Y');
    END IF;
    FOR i IN lv_cols.FIRST..lv_cols.LAST LOOP
    lv_col := lv_cols(i);
    --get flag indicating the propagation type       
    lv_isProp := isColumnIsPropagated_fnc(lv_dest.destSchema,
    lv_dest.destDatabase,
    lv_lcr.get_object_name,
    lv_col.column_name);
    IF lv_isProp = gv_column_NOT_propagated THEN
    lv_lcr.delete_column(lv_col.column_name, '*');
    --if the command type is an UPDATE and the column is a PK, keep the value
    ELSIF lv_lcr.get_command_type = 'UPDATE' AND
    lv_isProp = gv_columnPK_propagated
    THEN
    lv_pkValues(lv_col.column_name) := lv_col.data;
    END IF;
    END LOOP;
    --swith the old_values array to the new_values array when it is a DELETE
    IF lv_lcr.get_command_type = 'DELETE' THEN
    lv_cols_old := lv_lcr.get_values('old');
    lv_lcr.set_values('new',lv_cols_old);
    END IF;
    -- remove the old values array
    lv_lcr.set_values('old', NULL);
    --when it's an UDPATE, the primary key column(s) needs to be recreated
    IF lv_lcr.get_command_type IN ('UPDATE') THEN
    lv_isUPDATE := TRUE;
    END IF;
    --convert the command_type to an INSERT
    IF lv_verbose = 1 THEN
    lv_msg := lv_msg||'Set command_type to INSERT; '||CHR(10);
    END IF;
    lv_lcr.set_command_type('INSERT');
    --when it's an UDPATE, the primary key column(s) needs to be recreated
    IF lv_isUPDATE = TRUE THEN
    lv_next := lv_pkValues.FIRST;
    WHILE lv_next IS NOT NULL LOOP
    lv_lcr.add_column('new', lv_next, lv_pkValues(lv_next));
    lv_next := lv_pkValues.NEXT(lv_next);
    END LOOP;
    END IF;
    --rename source database  and object owner for the destination
    lv_lcr.set_source_database_name(lv_dest.destDatabase);
    lv_lcr.set_object_owner(lv_dest.destSchema);
    RETURN ANYDATA.ConvertObject(lv_lcr);
    END transform;

  • Using dynamic sql in triggers with :OLD values

    i need to record all deleted rows from an entire schema in a single table. for that matter i created a function that receives a table name and generate an insert command according to it's primary key columns. i call this function in the table triggers. in order to insert the old values before the delete i use :OLD with "execute immediate" as followed :
    create or replace trigger trg_some_tbl_bd
    before delete on some_tbl
    for each row is
    declare
    v_sql varchar2(4000);
    begin
    v_sql := generate_insert_command('some_table');
    execute immediate v_sql;
    end;
    the return value from "generate_insert_command" function is the string:
    insert into deleted_table (table_name , date , pk1 , pk2) values
    ('some_table' , sysdate , :OLD.pk1 , :OLD.pk2)
    the execute immediate command notice the :OLD and looks for bind variables.
    i need to know i can i bypass that. i tried looking for escape characters but couldent find any...
    i would appriciate any help , it's kynda urgent
    Thanks !

    I don't believe this is going to work. Even if you could get around the fact that :old looks like a bind variable, the :old values are not visible to the dynamic SQL statement, they're like local variables in that respect.
    If you wanted to pass old values in, those values would have to be passed in as bind variables, i.e.
    EXECUTE IMMEDIATE v_sql USING :old.pk1, :old.pk2which defeats the purpose of using dynamic SQL.
    Since you have to create a trigger for each table, I don't see why you would bother with dynamic SQL inside the trigger-- your table structure is fixed when the trigger is created. You could write dynamic SQL that generated the triggers in the first place, but the code inside the trigger should be dynamic.
    As an aside, you realize that logging every audit record into a single table creates rather massive contention issues, right? And have you considered how painful it is to query this sort of table? Have you considered other options for maintaining history like Workspace Manager? Or at least separate history tables for each table?
    Justin

  • JbiValidator calls the setAttribute to the old value when validate fails

    I tried to implement a Custom Validator by extending a JboValidator Interface. I applied the validator to an attribute. I tested the the validation on a JSF page. When I input an invalid value on the attribute, the validator runs but the problem is the framework sets the value of the attribute to its old value by calling again the setter function (setAttribute()) which in turn calls the validator again.
    This is what I have observed. If this is what the framework really does, then how can I suppress the firing of the validator when it sets it back to the old value?
    regards,
    Anton

    Thanks to all for your responses. Regarding accessing of new value inside value change listener, I am sure ValueChangeEvent.getNewValue() is not going to give me the value with proper data type. I am not using immediate attribute anywhere but use custom domain data type with masking (i.e. Formatter Format). Also I use InputDate field. Always valueChangeEvent.getNewValue() gives me the string representation of the value but not with actual data type.
    Question:
    1. Is there any API, that gets the valueChangeEvent.getNewValue() and the UI components as parameters and return the data with proper data type?
    2. I need to get the newly value with proper data type inside valueChangeListener. Is it achievable? If so, how?
    Need your help.

  • Returning an old phone on Edge?

    I recently used the Edge program to get a new iPhone 6. I still have my iPhone 4, and want to avoid the $200 charge (I upgraded on Early Edge and returning the old phone is a requirement). However I have no idea where to mail my old phone or how to make sure it is associated with my account. I went to my local Verizon store and they said they could not take it there. Any help?

    Here's the link.  You have to log in and it should take you directly to the label page.  I've heard that using Internet Explorer is a better option than using Chrome or Firefox when trying to print the label.
    VerizonWireless.com/printlabel
    Good luck!

  • How to get old value from IWDCustomEvent

    Hello All,
    I have applied a Listener on a field value. I want to get old value from the IWDCustomEvent as well new value when event will get fire. Is it possible in Web Dynpro.

    Hi
    Probably you need to get the record from backend base on the date of insertion. and then store it into the WD context, and simple java to compare the old and new record based on date of insertion and again put back to WD Context then finally you can use  WDCustomEvent to get the data.
    Hope it will help you.
    Thanks

  • Request.getParameter("checkbox") Returns only one value

    Hello Friends,
    I have a very urgent problem on live site. I moved my project from jrun2.3.3 to Jrun 3.1 and I was using multiple select and checkboxes.
    With Jrun3.1 if you select multiple select or multiple checkboxes it returns only one value instead of all the values.
    Any help is hightly appreciated.

    If multiple checkboxes have the same name, when selected and submitted, it will pass all values. But you will need to access those using getParameterValues("checkboxname") not getParameter("checkboxname"). The same goes for select elements.
    Perhaps it was a bug in JRun 2.3.3 that allowed you to reference all parameter values using just the getParameter("xxx") method.

  • Cant able to see new value and old value for change in purchase order text

    Hi all ,
    I am not able to see changes done in material's purchase order text in material master. When i use tcode MM04 to see changes done material master it does not report new and old value for change if it is done in purchase order text of that material .
    Thanks in advance  ,
    Shikha

    Hi Shikha,
    I'm not sure it works or not. But you can try SCU3 t.code and table DBTABLOG. May it can help you out.
    I also faced this type of issue in Plant data and it get resolved.
    Try and let me know...
    Regards
    Sunil Sisodia

Maybe you are looking for