UPDATE statement not working as expected

In our table we have a field with length of nvarchar(70) which is used to store multiple values that can be queried using SUBSTRING. There are already 54 characters in the field including the final quote.
The Start and end characters of the field are always a single quote.
I need to update the field, adding up to 3 characters from another reference table.
I tried the below, but it is missing of the last character when the number is greater than 9.
update Hermes_Rep.dbo.ActData
set spare6= LEFT(Spare6+SPACE(57),57) + ''''
FROM Hermes_Rep.dbo.ACTdata
LEFT JOIN KFILDTO_YARPF YAR ON ACTdata.ACNo COLLATE Latin1_General_CI_AS= YAR.YARCUS COLLATE Latin1_General_CI_AS
where DataDate='2014-09-16'
For example, if the data I am adding is `N9'` it works, but if the data is `N11` it only puts in `N1`
So what am I doing wrong here?

here is the DDL for the column:
[SPARE6] [nvarchar](70) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
and the DML is in my question.
Here are some examples of the existing data in the column
' E D 0000000000000S C C S '
' 90 0 E D 0000000000000B1 C C B '
' 0 0000000000000 '
' 0 0000000000000B2 B '
' 0 1 D 0000474003317 H1B '
'16 90 0 F D 0000000000000B1 D D B '
'28 90 0 C D 0000000000000B1 A3D B '
'16 01 F D 0000000000000B1 D D B '
'12 F D 0000000000000S C D S '
' 201 F D 0000000000000S D D S '
'29 201 C D 0000000000000S A3D S '
'12 E D 0000000000000S C C S '
' 0000000000000 '
' 1 D 0000000000000S C S '
' 01 D 0000000000000B1 C B '
' 01 E D 0000000000000B1 C C B '

Similar Messages

  • UPDATE statement not working

    Hi,
    I want to modify the record of PA0009 .I want to change the enddate of personnel No.
    UPDATE PA0009 SET ENDDA = '30.10.2009'
                  WHERE PERNR = '1'
                  AND BEGDA =  '01.09.2008'.
    The above statement is not working. How to modify the enddate which is part of key table.
    Please guide.
    Thanks and Regards
    K Srinivas

    Hello,
    Set the data format to the internal date format (YYYYMMDD), so in the set and the where clause pass '20091030' as ENDA which is to be changed and BEGDA in the where clause as 20080901. Also if the after the changes if the key combination results in dupicate records then the update will faiil. Just make sure that the combination of PERNR,SUBTY,OBJPS,SPRPS,ENDDA, BEGDA and SEQNR remains unique, if a record exists with this combination then sy-subrc will be 4 and the record will not be updated.
    Regards,
    Sachin

  • Update statement not working PL/SQL block

    Hi friends,
    My code is written the following way:
    declare
    var1 number;
    var2....
    Cursor c1 <select something>;
    Cursor c2 <select something>
    Begin
    Insert into table1 <different values>;
    Commit;
    /* first update statement */
    Update table1 set table1.col3 = (select col3 from table2 where table2.col1 = table1.col1 and table2.col2 = table1.col2);
    commit ;
    /* 2nd update statement */
    update table1 set table1.col4 = (select col4 from table3 where table3.col1 = table1.col1 and table3.col2 = table1.col2);
    commit ;
    for r2 in c2 loop
    update table1
    end loop;
    end;
    This code works till 1st update statement. But after that, even if I let my code run overnight, nothing happens. There are appropriate indexes on tables where join is done. All tables are in one schema.
    What could be the reason?

    darshilm wrote:
    /* first update statement */
    Update table1 set table1.col3 = (select col3 from table2 where table2.col1 = table1.col1 and table2.col2 = table1.col2);This is an unconstrained updated - meaning that it instructs the database that every single row in TABLE1 needs to be updated.
    For every single row, the "update" SQL has to be executed and a SELECT performed on TABLE2.
    Let's say there are a 100,000 rows in TABLE1. This means that the SELECT to find the updated value has to be executed a 100,000 times.
    Let's say that there are a 200,000 rows in TABLE2. This means that each time that SELECT runs, it potentially hits 200,000 rows. Does it do it via a full table scan? Index range scan?
    At what cost? Hitting the very same data set again and again and again, 100,000 times in a row.
    And that is only the start of your code... and you wonder why it does not seem to finish?
    Data processing in a RDBMS is about how to do the minimal amount of I/O to achieve the desired result. For example, instead of hitting TABLE2 100,000 times, you can write code to hit it once by joining it with TABLE1 and creating an "updateable view" of TABLE1 that can be updated with the join values of TABLE2.
    You also seem to use PL/SQL cursors to perform row-row (and slow-by-slow) processing. This typically pulls data from the SQL engine into the PL engine and then push that very same data from the PL engine to the SQL engine.. It is a lot faster and more efficient (and scalable) to rather stay inside the SQL engine and do data set processing there (as oppose to row-by-row on the client side).
    Performance in a RDBMS is primarily determined by the designer and the developer... are functions of how well designed the data model is, and how well designed and written the code is.

  • Update statement not working inside DBMS_PARALLEL_EXECUTE

    CREATE OR REPLACE procedure
    proc_table_mask_par2 (p_tblName in varchar2
    ,p_strmCount in number)
    IS
    | Name: proc_table_mask
    | Version: 1.0
    | Function: The procedure generates the block which will mask the table based on inputrs from
    MSK_INVENTORY_COLS table
    | Modification History:
    | Ver: Date: Who: What:
    | 1.0 2012-11-26 HB Created
    vtbl_Name varchar2(100);
    vtbl_Count number(19,0);
    vStrm_row_count number(19,0);
    vCurs_count number(19,0) := 1;
    vsql varchar2(30000);
    vsql1 varchar2(30000);
    vstragg varchar2(4000);
    v_try number;
    v_status number;
    v_status1 number;
    vtaskName varchar2(100) := 'Mask job for '||p_tblName ;
    pstartnum number(19,0);
    pendnum number(19,0);
    v_prim_key varchar2(100);
    --retries_in  PLS_INTEGER DEFAULT 2;
    --l_attempts    PLS_INTEGER := 1;
    begin
    -- Use function Stragg to get the update statement from MSK_INVENTORY_COLS
    select stragg(MIC.COLUMN_NAME || ' = ' || MIC.FUNCTION_NAME|| '(' ||MIC.COLUMN_NAME||')') into vstragg from MSK_INVENTORY_COLS mic
    WHERE MIC.TABLE_NAME = p_tblName;
    EXECUTE IMMEDIATE 'select count(1) from '||p_tblName into vtbl_Count;
    --DBMS_OUTPUT.PUT_LINE ( 'vtbl_Count : ' ||vtbl_Count);
    vStrm_row_count := round( vtbl_Count/p_strmCount);
    dbms_output.put_line(' vStrm_row_count : ' || vStrm_row_count);
    -- Update statement
    vsql := vsql ||chr(10) || ' UPDATE '|| p_tblName || ' /*+ parallel ( '||p_tblName ||', '||p_strmCount||') */ ' ;
    vsql := vsql ||chr(10) || ' SET '|| vstragg;
    vsql := vsql ||chr(10) || ' , lock_id = -1 ' ;
    vsql := vsql ||chr(10) || 'WHERE ROWID BETWEEN :starting_rowid AND :ending_rowid' ;
    vsql := vsql ||chr(10) || ' and lock_id <> -1 ; ' ;
    dbms_output.put_line (' vsql : ' || vsql);
    DBMS_PARALLEL_EXECUTE.CREATE_TASK (vtaskName);
    DBMS_PARALLEL_EXECUTE.CREATE_CHUNKS_BY_ROWID (task_name => vtaskName
    , table_owner => SYS_CONTEXT ('USERENV', 'SESSION_USER') --USER
    , table_name => p_tblName
    , by_row => TRUE
    , chunk_size => vStrm_row_count
    DBMS_PARALLEL_EXECUTE.RUN_TASK (task_name => vtaskName
    , sql_stmt => vsql
    , language_flag => DBMS_SQL.native
    , parallel_level => p_strmCount
    -- Only resume for the following
    -- INVALID_STATE_FOR_REDSUME ORA - 29495
    -- Attempts to resume execution, but the task is not in FINISHED_WITH_ERROR or CRASHED state
    -- Constant value for CRASHED = 8
    -- Constant value for FINISHED_WITH_ERROR = 7
    v_try := 0;
    v_status := DBMS_PARALLEL_EXECUTE.TASK_STATUS(vtaskName);
    dbms_output.put_line (' v_status : ' || v_status);
    dbms_output.put_line (' v_try : ' || v_try);
    WHILE(v_try < 2 and v_status != DBMS_PARALLEL_EXECUTE.FINISHED and ((v_status = 7) or( v_status = 8) ))
    LOOP
    v_try := v_try + 1;
    DBMS_OUTPUT.PUT_LINE (' Why am I getting into this loop : ' );
    DBMS_PARALLEL_EXECUTE.RESUME_TASK(vtaskName);
    v_status := DBMS_PARALLEL_EXECUTE.TASK_STATUS(vtaskName);
    END LOOP;
    DBMS_PARALLEL_EXECUTE.DROP_TASK(vtaskName);
    exception
    when
    others then
    raise;
    dbms_output.put_line(sqlerrm);
    end;
    Gurus
    I am executing the procedure above using the following anonymous block.
    DECLARE
    P_TBLNAME VARCHAR2(32767);
    P_STRMCOUNT NUMBER;
    BEGIN
    P_TBLNAME := 'EMPLOYEE_DIM';
    P_STRMCOUNT := 10;
    A516907.PROC_TABLE_MASK_PAR2 ( P_TBLNAME, P_STRMCOUNT );
    COMMIT;
    END;
    I have used dbms_output for getting values for the following variables. When I check the values the update does not seem to be working.
    vStrm_row_count : 60143
    vsql :
    UPDATE EMPLOYEE_DIM /*+ parallel ( EMPLOYEE_DIM, 10) */
    SET
    BUSINESS_TITLE_NM = FN_TITLE_DRM_ENCRYPTNSUM(BUSINESS_TITLE_NM),COST_CENTER_CD =
    FN_COSTCTR_DRM_ENCRYPTNSUM(COST_CENTER_CD),DIRECT_MGR_NM =
    FN_DRM_REG_ADDR_TEXT(DIRECT_MGR_NM),FIRST_NM =
    FN_FNM_DRM_ENCRYPTNSUM(FIRST_NM),LAST_FIRST_FULL_NM =
    FN_DRM_REG_ADDR_TEXT(LAST_FIRST_FULL_NM),LAST_FIRST_MIDDLE_FULL_NM =
    FN_DRM_REG_ADDR_TEXT(LAST_FIRST_MIDDLE_FULL_NM),LAST_NM =
    FN_LNM_DRM_ENCRYPTNSUM(LAST_NM),PHONE_NO =
    FN_PHONE_DRM_ENCRYPTNSUM(PHONE_NO),PRIMARY_EMAIL_ADDRESS_NM =
    FN_EMAIL_DRM_ENCRYPTNSUM(PRIMARY_EMAIL_ADDRESS_NM)
    , lock_id = -1
    WHERE ROWID
    BETWEEN :starting_rowid AND :ending_rowid
    and lock_id <> -1 ;
    v_status : 4
    v_try : 0

    I tried to do the update using chunk sql and ran the procedure again..No updates are made.
    CREATE OR REPLACE procedure
    proc_table_mask_chunk_sql (p_tblName in varchar2
    ,p_strmCount in number)
    IS
    | Name: A516907.proc_table_mask
    | Version: 1.0
    | Function: The procedure generates the block which will mask the table based on inputrs from
    MSK_INVENTORY_COLS table
    | Modification History:
    | Ver: Date: Who: What:
    | 1.0 2012-11-26 HB Created
    vtbl_Name varchar2(100);
    vtbl_Count number(19,0);
    vStrm_row_count number(19,0);
    vCurs_count number(19,0) := 1;
    vsql varchar2(1000);
    vsql_pk varchar2(1000);
    vstragg varchar2(4000);
    vtaskName varchar2(100) := 'Mask Data in table '||p_tblName ;
    pstartnum number(19,0);
    pendnum number(19,0);
    upd_st number(19,0) := 1;
    v_prim_key varchar2(100);
    l_try NUMBER;
    l_status NUMBER;
    begin
    DBMS_PARALLEL_EXECUTE.CREATE_TASK (vtaskName);
    -- Use function Stragg to get the update statement from MSK_INVENTORY_COLS
    select stragg(MIC.COLUMN_NAME || ' = ' || MIC.FUNCTION_NAME|| '(' ||MIC.COLUMN_NAME||')') into vstragg from MSK_INVENTORY_COLS mic
    WHERE MIC.TABLE_NAME = p_tblName;
    select stragg(UCC.COLUMN_NAME) COLUMN_NAME into v_prim_key
    from user_constraints uc , user_cons_Columns ucc
    where UC.CONSTRAINT_TYPE = 'P'
    and UC.CONSTRAINT_NAME = UCC.CONSTRAINT_NAME
    and UCC.TABLE_NAME = p_tblName;
    vsql_pk := 'SELECT distinct ' || v_prim_key || ','|| v_prim_key || ' FROM ' || p_tblName;
    DBMS_OUTPUT.PUT_LINE ( 'vsql_pk : ' ||vsql_pk);
    --EXECUTE IMMEDIATE ' select stragg(COLUMN_NAME ||''=''||FUNCTION_NAME||''(''||COLUMN_NAME||'')'') from MSK_INVENTORY_COLS WHERE TABLE_NAME = ' ||p_tblName  INTO vstragg ;
    --EXECUTE IMMEDIATE 'select count(1)   from vtbl_Name' into vtbl_Count;
    EXECUTE IMMEDIATE 'select count(1) from '||p_tblName into vtbl_Count;
    --DBMS_OUTPUT.PUT_LINE ( 'vtbl_Count : ' ||vtbl_Count);
    vStrm_row_count := round( vtbl_Count/p_strmCount);
    DBMS_PARALLEL_EXECUTE.CREATE_CHUNKS_BY_SQL(vtaskName, vsql_pk, false);
    --DBMS_OUTPUT.PUT_LINE ( 'vStrm_row_count : ' ||vStrm_row_count);
    --EXECUTE IMMEDIATE 'SELECT MIN( '||v_prim_key||') from ' ||p_tblName into pstartnum;
    ----dbms_output.put_line (' pstartnum : ' || pstartnum);
    --pendnum :=  vStrm_row_count;
    ----dbms_output.put_line (' pendnum : ' || pendnum);
    -- Update statement
    vsql := vsql ||chr(10) || ' UPDATE '|| p_tblName || ' /*+ parallel ( '||p_tblName ||', '||p_strmCount||') */ ' ;
    vsql := vsql ||chr(10) || ' SET '|| vstragg;
    vsql := vsql ||chr(10) || ' , lock_id = -1 WHERE ' ;
    vsql := vsql ||chr(10) || v_prim_key|| ' BETWEEN :start_id and :end_id ';
    vsql := vsql ||chr(10) || ' and lock_id <> -1 ; ' ;
    --DBMS_PARALLEL_EXECUTE.CREATE_TASK (vtaskName||'_'||upd_st);
    DBMS_PARALLEL_EXECUTE.RUN_TASK ( vtaskName
    , vsql
    , DBMS_SQL.native
    , parallel_level => p_strmCount
    L_try := 0;
    L_status := DBMS_PARALLEL_EXECUTE.TASK_STATUS(vtaskName);
    WHILE(l_try < 2 and L_status != DBMS_PARALLEL_EXECUTE.FINISHED and ((L_status = 7) or( L_status = 8) ))
    Loop
    L_try := l_try + 1;
    DBMS_PARALLEL_EXECUTE.RESUME_TASK(vtaskName);
    L_status := DBMS_PARALLEL_EXECUTE.TASK_STATUS(vtaskName);
    END LOOP;
    end;
    Block run :
    DECLARE
    P_TBLNAME VARCHAR2(32767);
    P_STRMCOUNT NUMBER;
    BEGIN
    P_TBLNAME := 'EMPLOYEE_DIM';
    P_STRMCOUNT := 10;
    A516907.PROC_TABLE_MASK_CHUNK_SQL ( P_TBLNAME, P_STRMCOUNT );
    COMMIT;
    END;
    /

  • ACS 5.2 - User accounts File Update is not working as expected

    Hello, I have serious problem with importing Fixed IPs to User accounts in ACS 5.2.
    Because this attribute can't be migrated directly I try it via "File Operations --> Update". I have created file according to Update template but entered IP addresses are not imported - every other attribute can be changed without problem.
    If I will try "File Operations --> Add" it is working well, but I can't use this option.
    IPv4 address atribute in "System Administration --> Configuration --> Dictionaries --> Identity --> Internal Users" is added properly and appropriate field is present in Users accounts.
    Do you have any idea what can be wrong?

    Hi Michal,
    yes I filed this as a bug very recently. It happens after a migration from ACS 4.
    CSCtk05027 : users custom fields after migration - import/update doesn't work
    Try to modify one of your user entry. Just add an ip address manually there for example. Then do the file update. It will work for that user and it will update the ip address.
    The workaround is to exports all your ACS 5 users. Then delete them from the database then do a file import "add" instead of update. A bit of a silly workaround but the bug should be fixed in future patches (no information on that yet).
    Regards,
    Nicolas
    ===
    Don't forget to rate answers that you find useful

  • UPDATE statement not working when updating Z table

    Hi
    I have declared Ztable with fields MANDT, VKORG, VBELN, IDENTCODE and POSNR as key fields, other fields are FKDAT,KUNNR, NETWR, WAERK, SKFBP
    First I got the data from presentation server and moved into internal table 'A' and after that declared internal table with structure same as Z table and moving the data from presentation server internal table 'A' into this.
    After Endloop I am using statement
          UPDATE ZVS_INV FROM TABLE IT_INV.
         commit work.
    But  table is not getting updated and sy-subrc is returning to 4.
    What could be the reason...your help appreciated.

    howcan it make difference if the primary key is defined as per my business requirement
    Just because the business requirement 'says so', doesn't mean that's it's right.  You appear to be maintaining a Z-table with a subset of billing fields and appear to have 'over-specified' the primary key.
    As far as the help files, if you did look at them, I don't think you took the time to understand before just posting your problem here.  An UPDATE operation is a very simple operation.  You gave the answer to why it didn't work in your comments as Keshav already pointed out...

  • Case statement not working as expected

    I get this error having the group by clause: ORA-00979: not a GROUP BY expression
    I get this error with out it: ORA-00937: not a single-group group function
    If I add sp.PUBLISHER_ID to the group by, my data comes out on separate lines like this:
    BT jlloyd ALLEN IVERSON B 0 3 0
    BT jlloyd ALLEN IVERSON B 1 0 0
    What am I doing wrong?
    select distinct office_id,user_id,
    nvl(customer, profile_name),
    nvl(account, profile_name),
    profile_name,
    profile_type,
    case when sp.PUBLISHER_ID = 503
    then count(distinct sp.instance_id)
    else 0 end as MR_Reports ,
    case when sp.PUBLISHER_ID = 501
    then count(distinct sp.instance_id)
    else 0 end as QV_Reports,
    case when sp.PUBLISHER_ID = 3533
    then count(distinct sp.instance_id)
    else 0 end as BS_Reports
    from vw_profile_info p join SOLD_PUBLISHERS sp
    on p.profile_id = sp.profile_id
    join SOLD_SEGMENTS ss
    on ss.profile_id = sp.PROFILE_ID
    and ss.instance_id = sp.instance_id
    and ss.BASKET_ID = sp.basket_id
    join publishers p
    on p.publisher_id = sp.publisher_id
    where sp.publisher_id in (501,503,3533)
    and sp.PUBLISHED_DATE between to_date('10/01/2005','mm/dd/yyyy') and
    to_date('10/31/2005','mm/dd/yyyy')
    and profile_name = 'ALLEN IVERSON
    group by office_id,user_id,
    nvl(customer, profile_name),
    nvl(account, profile_name),
    profile_name,
    profile_type

    There are couple of ways, one of them would be
    select office_id,
           user_id,
           nvl(customer, profile_name),
           nvl(account , profile_name),
           profile_name,
           profile_type,
           sum(decode(sp.PUBLISHER_ID,  503, 1, 0) MR_Reports,
           sum(decode(sp.PUBLISHER_ID,  501, 1, 0) QV_Reports,
           sum(decode(sp.PUBLISHER_ID, 3533, 1, 0) BS_Reports
    from vw_profile_info p join SOLD_PUBLISHERS sp
         on p.profile_id = sp.profile_id
         join SOLD_SEGMENTS ss
         on ss.profile_id = sp.PROFILE_ID
         and ss.instance_id = sp.instance_id
         and ss.BASKET_ID = sp.basket_id
         join publishers p
         on p.publisher_id = sp.publisher_id
    where sp.publisher_id in (501,503,3533)
    and sp.PUBLISHED_DATE between to_date('10/01/2005','mm/dd/yyyy') and to_date('10/31/2005','mm/dd/yyyy')
    and profile_name = 'ALLEN IVERSON'
    group by office_id,
             user_id,
             nvl(customer, profile_name),
             nvl(account , profile_name),
             profile_name,
             profile_type

  • Selection statement not working as expected

    The hotter and cooler methods are the ones in question. It just prints "Cannot go below the minimum temperature" ,no matter what value I set increment, min, or max to. It also does not change the value of temperature.
    I've already tried adding parentheses like this : if ((temperature - incremen)t <= min)
    public class Heater
        //the current temperature
        private int temperature;
        //the minimum temperature
        private int min;
        //the maximum temperature
        private int max;
        private int increment;
        public Heater(int minimum, int maximum)
            min = minimum;
            max = maximum;
            increment = 5;
            temperature = 15;
        //decreases the temperature by 5
        public void cooler()
            if (temperature - increment <= min)
            temperature = temperature - increment;
            else
            System.out.println("Cannot go below the minimum temperature");
        //increases the temperature by 5
        public void hotter()
            if (temperature + increment >= max)
            temperature = temperature + increment;
            else
                System.out.println("Cannot go above the maximum temperature");
       //sets the amount to increment the heat by
        public void setIncrement(int incrementAmount)
            if (incrementAmount > 0)
            increment = incrementAmount;
            else
            System.out.println("Please enter a positive amount");
        //returns the current temperature
        public int getTemperature()
            return temperature;
    }

    Hi,
    you mixed the conditions. you want to stay above minimum and below maximum:
    if (temperature - increment >= min)
    if (temperature + increment <= max)

  • Update query not working in the JDBC sender Communication channel

    Hi,
    We are working on JDBC to File scenario. As per the configuration, XI should pick the data from SQL database every 20 secs and should update the corresponding flag. We are using subquery in the select and update statement as both header and detail tables are involved.
    Now the issue is, select query is working fine but update statement is not working as expected. It is somehow updating some other records rather than doing for the ones selected by the adapter.
    Moreover logSQLstatement is also not working. Hence we are unable to identify the records which are getting updated.
    Please advise.

    Hi Rumi,
    See Question 8. Transaction Handling (Sender) in [SAP Note 831162 - FAQ: XI 3.0 / PI 7.0 / PI 7.1 JDBC Adapter|https://websmp130.sap-ag.de/sap(bD1wdCZjPTAwMQ==)/bc/bsp/spn/sapnotes/index2.htm?numm=831162].
    8.  Transaction Handling (Sender)
    Q: If I have the following configured in a JDBC Sender:
    Select Query:
    SELECT column FROM TABLENAME WHERE FLAG = "TRUE"
    Update Query:
    UPDATE TABLENAME SET FLAG = "FALSE" WHERE FLAG = "TRUE"
    How do I know that the JDBC adapter will not update newly added rows (rows that were
    added between the time that the SELECT and UPDATE queries were executed) that were
    not read in the initial SELECT query?
    A: The SELECT and the UPDATE are run in the same DB transaction, i.e. both statements
    have the same view on the database.
    Make sure that both statements use the same WHERE clause. An additional
    requirement for the correct operation of this scenario is the configuration of
    an appropriate transaction isolation level on the database
    (i.e., repeatable_read or serializable). You might also consider using a
    "SELECT FOR UPDATE" statement instead of a plain SELECT statement to
    ensure proper locking on the database. "SELECT FOR UPDATE"
    is not supported in MS SQL database. In this case please make use of an
    appropriate transaction isolation level on the database. For more details
    please contact your DB vendors.
    After, see Transaction Handling Issues in [SAP Note 1039779 - JDBC Adapter issues(Escape character,Transaction handling)|https://websmp130.sap-ag.de/sap(bD1wdCZjPTAwMQ==)/bc/bsp/spn/sapnotes/index2.htm?numm=1039779].
    Best Regards.
    Pedro Baroni

  • Silverlight 5 binding on a property with logic in its setter does not work as expected when debug is attached

    My problem is pretty easy to reproduce.
    I created a project from scratch with a view model.
    As you can see in the setter of "Age" property I have a simple logic.
        public class MainViewModel : INotifyPropertyChanged
                public event PropertyChangedEventHandler PropertyChanged;
                private int age;
                public int Age
                    get
                        return age;
                    set
                        /*Age has to be over 18* - a simple condition in the setter*/
                        age = value;
                        if(age <= 18)
                            age = 18;
                        OnPropertyChanged("Age");
                public MainViewModel(int age)
                    this.Age = age;
                private void OnPropertyChanged(string propertyName)
                    if (this.PropertyChanged != null)
                        PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
    In the MainPage.xaml 
         <Grid x:Name="LayoutRoot" Background="White">
                <TextBox 
                    Text="{Binding Path=Age, Mode=TwoWay}" 
                    HorizontalAlignment="Left"
                    Width="100"
                    Height="25"/>
                <TextBlock
                    Text="{Binding Path=Age, Mode=OneWay}"
                    HorizontalAlignment="Right"
                    Width="100"
                    Height="25"/>
            </Grid>
    And MainPage.xaml.cs I simply instantiate the view model and set it as a DataContext.
        public partial class MainPage : UserControl
            private MainViewModel mvm;
            public MainPage()
                InitializeComponent();
                mvm = new MainViewModel(20);
                this.DataContext = mvm;
    I expect that this code will limit set the Age to 18 if the value entered in the TextBox is lower than 18.
    Scenario: Insert into TextBox the value "5" and press tab (for the binding the take effect, TextBox needs to lose the focus)
    Case 1: Debugger is attached =>
    TextBox value will be "5" and TextBlock value will be "18" as expected. - WRONG
    Case 2: Debugger is NOT attached => 
    TextBox value will be "18" and TextBlock value will be "18" - CORRECT
    It seems that when debugger is attached the binding does not work as expected on the object that triggered the update of the property value. This happens only if the property to which we are binding has some logic into the setter or getter.
    Has something changed in SL5 and logic in setters is not allowed anymore?
    Configuration:
    VisualStudio 2010 SP1
    SL 5 Tools 5.1.30214.0
    SL5 sdk 5.0.61118.0
    IE 10
    Thanks!                                       

    Inputting the value and changing it straight away is relatively rare.
    Very few people are now using Silverlight because it's kind of deprecated...
    This is why nobody has reported this.
    I certainly never noticed this problem and I have a number of live Silverlight systems out there.
    Some of which are huge.
    If you want a "fix":
    private void OnPropertyChanged(string propertyName)
    if (this.PropertyChanged != null)
    //PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
    Storyboard sb = new Storyboard();
    sb.Duration = new Duration(new TimeSpan(0, 0, 0, 0, 100));
    sb.Completed += delegate
    PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
    sb.Begin();
    The fact this works is interesting because (I think ) it means the textbox can't be updated at the point the propertychanged is raised.
    Please don't forget to upvote posts which you like and mark those which answer your question.
    My latest Technet article - Dynamic XAML

  • AFS ARUN Size Substitution Not Working As Expected

    Hi All,
    I need help with this. If any one of you have worked with AFS ARUN size substitution, kindly provide me with some details on how can I set it up. I am specially interested in setting up size substitution with two-dimensional grids.
    I have setup some examples but it does not work as expected.
    Here is a small example:
    Say I have a size 28/30, 28/32 .........29/30....
    What I want to achieve is that during ARUN if there is a shortage of stock in 28/30 then the remaining requirement qty should be confirmed from size 28/32.
    with my setup after 28/30 it goes into looking for stock in 29/30, which is what I do not want.
    Any inputs will be really appreciated.
    Thanks!!

    srdfrn wrote:
    Hi YOS,
    I tried importing a PCX image into CVI 2010 and then sizing the image to the control and didn't see the behavior you have been describing.  Would you mind posting an example (alongside an image file) that demonstrates this?
    Also, one thing I noticed is that PCX images appear to be quite dated.  Could upgrading them to a JPEG or PNG format be an option for you?
    Thanks,
    Stephanie R.
    National Instruments
    Stephanie, thanks for the reply.
    I am very sorry to state that I made a mistake.
    VAL_SIZE_TO_IMAGE indeed works.
    What fails to work is VAL_SIZE_TO_PICTURE. (Second option in Fit Mode attribute in control editing panel)
    I tried with JPEG and it's the same.
    I am attaching an example.(Load_Image.c & ONEP_3Trow_POS1.JPG)
    A panel with two picture rings.
    - SW_1 remains at the intended size and the loaded picture is not clear.
    - SW_2 will fit to picture size and looks OK.
    Appreciate your support,
    YOSsi Seter
    Attachments:
    Load_Image.c ‏2 KB
    ONEP_3Trow_POS1.JPG ‏4 KB

  • Update/Modify not working

    hi,
    i have ztable
    mandt key field
    ztest1  key field
    ztest2  key field
    ztest2  non key field
    when i'm trying to modify any key field, MODIFY keyword is actually adding a new record in the Database. it is because the new combination of key fields is unique.
    i tried using update statement . Update is not working as the combination key is creating a new record which is not present in Db and hence , its not updating.
    do we have any workaround on this ??
    if i update the key field same field should be updated with other fields intact
    please help.

    key field means unique record.
    if u try to change a key field it will add a new entry.
    to an existing entry with a key combination u can change only the non-key fields.
    else u need to delete the record combination and add the new combination.

  • DB Adapter polling as singleton process is not working as expected

    Am using poller DB adapater to control the transaction per seconds to the downstream system and i want this poller process as singleton (One instance should be in running state at a time).
    As suggested in oracle documents , below is the parameters configured in composite.xml file.
    <service name="polling_Mange_Alert_Events"
      ui:wsdlLocation="polling_Mange_Alert_Events.wsdl">
    <interface.wsdl interface="http://xmlns.oracle.com/pcbpel/adapter/db/Application1/int_app_manageAlerts/polling_Mange_Alert_Events#wsdl.interface(polling_Mange_Alert_Events_ptt)"/>
      <binding.jca config="polling_Mange_Alert_Events_db.jca">
      <property name="singleton">true</property>
      </binding.jca>
      <property name="jca.retry.count" type="xs:int" many="false" override="may">2147483647</property>
      <property name="jca.retry.interval" type="xs:int" many="false"
      override="may">1</property>
      <property name="jca.retry.backoff" type="xs:int" many="false"
      override="may">2</property>
      <property name="jca.retry.maxInterval" type="xs:string" many="false"
      override="may">120</property>
      </service>
    Below is the JCA file parameters configured :
    <adapter-config name="polling_Mange_Alert_Events" adapter="Database Adapter" wsdlLocation="polling_Mange_Alert_Events.wsdl" xmlns="http://platform.integration.oracle/blocks/adapter/fw/metadata">
      <connection-factory location="eis/DB/vff-int-fus" UIConnectionName="PT_APPINFRA" adapterRef=""/>
      <endpoint-activation portType="polling_Mange_Alert_Events_ptt" operation="receive">
        <activation-spec className="oracle.tip.adapter.db.DBActivationSpec">
          <property name="DescriptorName" value="polling_Mange_Alert_Events.ManageAlertEvents"/>
          <property name="QueryName" value="polling_Mange_Alert_EventsSelect"/>
          <property name="MappingsMetaDataURL" value="polling_Mange_Alert_Events-or-mappings.xml"/>
          <property name="PollingStrategy" value="LogicalDeletePollingStrategy"/>
          <property name="MarkReadColumn" value="TRANSACTION_STATUS"/>
          <property name="MarkReadValue" value="Processing"/>
          <property name="PollingInterval" value="10"/>
          <property name="MaxRaiseSize" value="5"/>
          <property name="MaxTransactionSize" value="5"/>
          <property name="NumberOfThreads" value="1"/>
          <property name="ReturnSingleResultSet" value="false"/>
          <property name="MarkUnreadValue" value="Pending"/>
        </activation-spec>
      </endpoint-activation>
    </adapter-config>
    This poller process is running on clustered environment (2 soa nodes) and it is not working as expected as singleton process.
    Please advise to solve this issue ?

    Hi,
    1.Set Singleton property outside   <binding.jca> like this:
    <binding.jca config="polling_Mange_Alert_Events_db.jca"/>
      <property name="singleton">true</property>
      <property name="jca.retry.count" type="xs:int" many="false" override="may">2147483647</property>
      <property name="jca.retry.interval" type="xs:int" many="false"
    2.Also you can try setting these values in jca file:
    <property name="RowsPerPollingInterval" value="100"/>
    <property name="MaxTransactionSize" value="100"/>
    3. try to increase the polling interval time.
    Regards,
    Anshul

  • UpsertDocumentAsync not working as expected

    I'm using UpsertDocumentAsync to either insert or update a document, but it doesn't seem to work as expected. When I use it either inserts / creates or
    replaces the document. I doubt I'm calling it wrong?
    await client.UpsertDocumentAsync(documentsLink, this.document);
    Working as expected (but with incorrect name) or not working as expected?
    Regards,
    Joakim
    Joakim Rosendahl Consultant at OnTrax AB, Sweden.

    Found this one (doesn't contain the work PATCH though)
    http://feedback.azure.com/forums/263030-documentdb/suggestions/7075256-provide-for-upsert
    Voted for that one, but it doesn't seem like the developer community is interested in upsert/patch functionality =/.
    Joakim Rosendahl Consultant at OnTrax AB, Sweden.

  • Windows update does not work after using System recovery disk

    I have a Toshiba Satellite c655 with WIndows 7 64 bit Home premium. The hard drive died on it, so I purchased a new hard drive and purchased the appropriate Recovery media from Toshiba. I followed the directions and installed the 3 disks on to the new hard drive. But Windows update does not work I get the following error: Windows update can not currently check for updates, because the service is not running. You may need to restart your PC    No matter what I try, I can not get it to work. And it will not let me install Windows Defender either. Any ideas or help would be appreciated. Thank you in advance for your time on this matter.
    Solved!
    Go to Solution.

    I get errors saying A problem is preventing the troubleshooter from starting.
    That makes two similarities to the following thread. Both Windows Update and Troubleshooters fail to work correctly.
       Trouble with reinstall of Win7 64 on a L505-ES5018
    The fix was to install a new hard disk driver.
       Intel Rapid Storage Technology
    -Jerry

Maybe you are looking for

  • 2-Page display in Acrobat 9.1.2

    I have a document created in ID CS4, of multiple facing pages, and exported to PDF.  But when I open it in Acrobat 9.1.2, and switch to 2-Page view, it displays with page one (a right-hand page) moved to the left of the screen, and page 2 (a left-han

  • Portal requests don't hit the deployed J2EE filter

    Hi, What I am tring to obtain is that all requests are filtered via a J2EE filter. I've deployed the filter and tested it successfully. The filter mapping was set to "/*" so that it catches all requests. It works fine when tested at the J2EE level. T

  • Why is that New Toolbar Created while costomizing crashes as soon as Firefox is closed?

    I am using Firefox for many years now and I simply love it.The fact that this is my first communication to you shows that I had absolutely no problems wit Firefox, until now that is! The problem is Add-on Buttons along with the Toolbar keep disappear

  • Why can't I sync iTunes music to my nano?

    I just bought an Apple Nano and I cant get my music thats in my music cloud to transfer to the Nano.  Someone Help!!!

  • How to increase my server performance ?

    hi experts, my environment is 4.7E,SQL,Windows 2003 Server with 150 users. ibm xseries 346 with 6 gb ram min response time is 1000 (m.sec) to 1500 per 140 logon users. how can i decrease this response time ? Please give me your valuable suggestions.