Updating field using trigger

I have a very basic table with four fields, DateReturned DueDate, daysoverdue and days. I am trying to use the following code to calculate the difference between the two dates and enter the result into days overdue. After this calculation I want to transfer only the positive values into the days field.
Calculation 1 - based on When-Button-Pressed
update test1 set daysoverdue = RETURNDATE - DUEDATE;
I can get this to work using the formula option in Property Palette - is there any way I can use an if statement. I only really want to calculate days overdue if the return date is after due date so that I have positive values only - this would avoid the need for calculation two.
Calculation two - - based on When-Button-Pressed
update test1 set days = RETURNDATE - DUEDATE
where daysoverdue >0;
When I compile and press the button - my application crashes. I can run the code via SQLPlus and it works.
What I would really like to do is the run the code automatically then the records are called up into the form. Any ideas and suggestions welcome. My PC that I am using is old and is a W2K machine with 256mb Ram and Approx 600Mhz processor.
This is my first application I am developing so if I have left out information - sorry.

my small advice is , pls do not write any
insert , update or delete in forms
if you want to do that pls call a database procedure
for ex
pls call a foll procedure in when-button-pressed
trigger
dp_update_overdue;
and write the foll script in your oracle database
create or replace procedure dp_update_overdue
is
begin
update test1
set daysoverdue = returndate- duedate
where returndate > duedate;
commit;
end;
bye
pasupathy

Similar Messages

  • Read from database (Access) and update fields using MS ADODB

    Hello,
    I am trying to get records from database using MS ADODB._connection & ADODB._Recordset objects (from LabVIEW 6)
    I can:
    1. open connection (with ADODB._connection)
    2. write into tables (with ADODB._command)
    I can not: gets records and update fields using ADODB._connection & ADODB._Recordset.
    I do not know:
    1. how to connect between the connection that was opened and the recordset object
    2. where I can write the SQL text as input to the recordset
    Attached is DataBase.llb with DB_read.vi that display my steps.
    Thanks.
    Attachments:
    DataBase.llb ‏40 KB

    Try this one, after updating the names for database and the table you want.
    Let me know if it's working.
    p.s.: if you have problems, it could be a different adodb version ... but the sequence of methods is the same
    Attachments:
    EditdatabaseMe.vi ‏57 KB

  • To update field using BAPI

    Hello experts,
    I have added one field using append structure in table MARC. I want to updated this field usnign BAPI_MATERIAL_SAVEDATA. can anybody tell me the procedure to do that?
    Thanks in advance.

    Hello,
    Check the documentation of the function module BAPI_MATERIAL_SAVEDATA. There is a parameter in the FM - EXTENSIONIN where in new fields added to the table can be used to be updated.
    The documentation of that parameters tells you how this can be achieved.
    Create 2 structures of the type BAPI_TE_MARA and BAPI_TE_MARAX
    Now assign the field structure of the workarea of type BAPIPAREX. Assume gs_extensionin is of type BAPIPAREX and gs_bapi_te_mara is of type BAPI_TE_MARA (this should have the fields that have been added in the table)
    gs_extensionin-structure = 'BAPI_TE_MARA'.
    gs_extensionin-valuepart+0(18) = gs_bapi_te_mara-matnr.
    gs_extensionin-valuepart+18(length of the new field) = ga_bapi_te_mara-<new field added in the structure>.
    append gs_extensionin to gt_extensionin.
    gs_extensioninx-structure = 'BAPI_TE_MARAX'.
    gs_extensioninx-valuepart+0(18) = gs_bapi_te_mara-matnr.
    gs_extensioninx-valuepart+18(1) = 'X'..
    append gs_extensioninx to gt_extensioninx.
    Now pass these tables gt_extensionin and gt_extensionx to the parameters extensionin and extensioninx of the function module BAPI_MATERIAL_SAVEDATA.
    Also try searching SDN using Extending BAPI's
    Hope this will help in solving your query.
    Regards,
    Sachin

  • UDF update field using Query

    Hi All,
    I have a udf field in OITM which we use to flag whether an item is obsolete or not, so Y or N is populated in all item records.
    I am trying to copy this field and its contents to be displayed in the Stock Data Tab (OITW) using a UDF but cannot get the query to work to automatically populate this new UDF?
    Any advice on the structure of the query or if I should try anything else would greatly received.
    Thanks, Richard

    Hi Richard......
    Try this......
    Select $[OITM.U_UDF.0]
    Replace UDF with your UDF Code and apply this FMS in the UDF at OITW area and then press Shift+F2
    Regards,
    Rahul

  • UPDATE FIELDS USING BADI INVOICE_UPDATE

    I have a requirement to change item level fields based on some condition during transaction MIRO, but the BADI INVOICE_UPDATE does not have any exporting parameters and thus not allow changing the fields. So is there any other way to do it? Appreciate your help.
    Thank you,
    Rohit
    Edited by: Julius Bussche on Mar 19, 2009 9:24 PM
    Please dont use CAPS-LOCK. It is generally interpreted as SHOUTING

    Hi,
    you could try to do something via field-symbols (but be careful):
    e.g.
    CONSTANTS: c_ydrseg(18) TYPE c VALUE '(SAPLMR1M)YDRSEG[]'.
      DATA: wa_drseg TYPE mmcr_drseg.
      CLEAR wa_drseg.
      FIELD-SYMBOLS: <fs_ydrseg> TYPE table.
      ASSIGN (c_ydrseg) TO <fs_ydrseg>.
      CLEAR lt_drseg.
      REFRESH lt_drseg.
      lt_drseg[] = <fs_ydrseg>.
      IF NOT <fs_ydrseg>[] IS INITIAL.
        LOOP AT lt_drseg INTO wa_drseg.
      * do something with EREKZ
        ENDIF.
      ENDIF.
    Best regards

  • Update Behavior using Multiple tables

    I'm trying to use the Update behavior from Dreamweaver MX2004
    to update fields from diferent joined tables. The search form works
    OK as I joined the tables and I get great results (see SQL Query
    below). When I try to create link to a detail page from the master
    page and I use the same recordset as below and I use the update
    behavior, I can only choose a table at the time to update fields
    using only one key. If I choose only one table and pass one key
    field is OK but I need to update all three joined tables. Is there
    a way to do something like this in the Link field in the master
    page calling the detail page? Is there is a correct way to pass the
    three keys from the master page to the detail page? I'm using ASP
    and standard SQL. The environment is Windows for testing and SQL
    server.
    Detail Page Parameters (not sure if this could be done):
    details_Admin_Skill_Resource.asp?resourceSkillMapID=
    <%=(Recordset1.Fields.Item("resourceSkillMapID").Value)%>?<%=(Recordset1.Fields.Item("skil lID").Value)%>?<%=(Recordset1.Fields.Item("resourceId").Value)%>
    I'm also inserting hidden fileds in the detail form. Any
    Ideas how to update several tables in DW MX2004 with the update
    behavior?
    This is the query in the recordset and it is working OK as it
    produces results from the search page. What modifications I need to
    do to this recordset in the update page?
    Thank you for your help!!!
    Carlos Melendez
    [email protected]
    This is what I typed in the advanced SQL box in the
    recordset.
    SELECT
    ResourceSkillMapping.resourceSkillMapID,ResourceSkillMapping.skillID,ResourceSkillMapping .competenceLevel,skill.skillname,resource.resourceName,resource.resourceLoginId,resource.r esourceId,resource.profileId,resource.resourceGroupID,resource.resourceType,resource.activ e,resource.autoAvail,resource.extension,resource.orderInRG,resource.dateInactive,resource. assignedTeamID,resource.resourceFirstName,resource.resourceLastName
    FROM ResourceSkillMapping INNER JOIN Skill ON
    ResourceSkillMapping.skillID = Skill.skillID INNER JOIN Resource ON
    ResourceSkillMapping.resourceSkillMapID =
    Resource.resourceSkillMapID
    WHERE (Resource.resourceLoginID LIKE '%Agent_asp%') AND
    (Resource.active = 1)
    Variables
    Skill_asp for skillName
    Agent_asp for resourceLoginID
    Default value of variables is 1 to display all records
    Runtime
    Request.QueryString("skillname")
    Request.QueryString("resourceLoginID")

    ITCoreTeam wrote:
    > I'm trying to use the Update behavior from Dreamweaver
    MX2004 to
    update fields
    > from diferent joined tables. The search form works OK
    as I joined the
    tables
    > and I get great results (see SQL Query below). When I
    try to create
    link to a
    > detail page from the master page and I use the same
    recordset as
    below and I
    > use the update behavior, I can only choose a table at
    the time to
    update fields
    > using only one key. If I choose only one table and pass
    one key field
    is OK but
    > I need to update all three joined tables. Is there a
    way to do
    something like
    > this in the Link field in the master page calling the
    detail page? Is
    there is
    > a correct way to pass the three keys from the master
    page to the
    detail page?
    > I'm using ASP and standard SQL. The environment is
    Windows for
    testing and SQL
    > server.
    > Detail Page Parameters:
    > details_Admin_Skill_Resource.asp?resourceSkillMapID=
    >
    >
    <%=(Recordset1.Fields.Item("resourceSkillMapID").Value)%>?<%=(Recordset1.Fields.
    >
    Item("skillID").Value)%>?<%=(Recordset1.Fields.Item("resourceId").Value)%>
    >
    > I'm also inserting hidden fileds in the detail form.
    Any Ideas how
    to update
    > several tables in DW MX2004 with the update behavior?
    >
    >
    > This is the query in the recordset and it is working OK
    as it
    produces results
    > from the search page. What modifications I need to do
    to this
    recordset in the
    > update page?
    >
    >
    > Thank you for your help!!!
    > Carlos Melendez
    > [email protected]
    >
    > This is what I typed in the advanced SQL box in the
    recordset.
    > SELECT
    >
    >
    >
    ResourceSkillMapping.resourceSkillMapID,ResourceSkillMapping.skillID,ResourceSki
    >
    llMapping.competenceLevel,skill.skillname,resource.resourceName,resource.reso
    >
    >
    >
    urceLoginId,resource.resourceId,resource.profileId,resource.resourceGroupID,reso
    >
    urce.resourceType,resource.active,resource.autoAvail,resource.extension,resou
    >
    >
    >
    rce.orderInRG,resource.dateInactive,resource.assignedTeamID,resource.resourceFir
    > stName,resource.resourceLastName
    > FROM ResourceSkillMapping INNER JOIN Skill ON
    ResourceSkillMapping.skillID =
    > Skill.skillID INNER JOIN Resource ON
    ResourceSkillMapping.resourceSkillMapID =
    >
    > Resource.resourceSkillMapID
    > WHERE (Resource.resourceLoginID LIKE '%Agent_asp%') AND
    (Resource.active = 1)
    > OR (Skill.skillName LIKE '%Skill_asp%')
    >
    > Variables
    > Skill_asp for skillName
    > Agent_asp for resourceLoginID
    >
    > Default value of variables is 1 to display all records
    >
    > Runtime
    > Request.QueryString("skillname")
    > Request.QueryString("resourceLoginID")
    >
    One solution is to create a view in SQL, that is exactly the
    same as
    your SELECT above. You then use the view name instead of the
    table name
    in your UPDATE statement. I know in the SQL world that this
    is possible,
    but I don't know if the Dreamweaver update behaviour will see
    the views
    stored on your SQL server.
    Steve

  • Add fields to maintenance view and update then using events

    Hi experts:
      I've created a table with 4 fields, one of them is userid. Also, there is a maintenance view to add new entries.
      I want to display user name when typing userid using events (1 or 21). I know how to do it if username is one of the fields of the table, but there is a requirement to not store username in the table, just userid.
    My question is: is possible to add a field into the maintenance view and update it using events but not store the value in DB?.
    Thanks in advance for your help.
    Regards,
    Carlos.

    In the save event just clear the entries of the field(user name) in the internal table.

  • How to update field values in a database table using module pool prg?

    hi
    how to update field values in a database table using module pool prg?
    we created a customized table, and we put 2 push buttons in screen painter update and display.
    but update is not working?
    data is enter into screen fields and to internal table, but it is not updated in database table.
    thanks in adv
    vidya

    HI,
    we already used the update statement. but its not working.
    plz check this.
    *& Module Pool       ZCUST_CALL_REC
    PROGRAM  ZCUST_CALL_REC.
    TABLES: ZCUST_CALL_REC,ZREMARKS.
    data:  v_kun_low like ZCUST_CALL_REC-kunnr ,
           v_kun_high like ZCUST_CALL_REC-kunnr,
           v_bud_low like ZCUST_CALL_REC-budat,
           v_bud_high like ZCUST_CALL_REC-budat.
    ranges r_kunnr for ZCUST_CALL_REC-kunnr  .
    ranges r_budat for zcust_call_rec-budat.
    DATA: ITAB TYPE STANDARD TABLE OF ZCUST_CALL_REC WITH HEADER LINE,
          JTAB TYPE STANDARD TABLE OF ZREMARKS WITH HEADER LINE.
    *data:begin of itab occurs 0,
        MANDT LIKE ZCUST_CALL_REC-MANDT,
        kunnr like ZCUST_CALL_REC-kunnr,
        budat like ZCUST_CALL_REC-budat,
        code like ZCUST_CALL_REC-code,
        remarks like ZCUST_CALL_REC-remarks,
        end of itab.
    *data:begin of Jtab occurs 0,
        MANDT LIKE ZCUST_CALL_REC-MANDT,
        kunnr like ZCUST_CALL_REC-kunnr,
        budat like ZCUST_CALL_REC-budat,
        code like ZCUST_CALL_REC-code,
        remarks like ZCUST_CALL_REC-remarks,
        end of Jtab.
    CONTROLS:vcontrol TYPE TABLEVIEW USING SCREEN '9001'.
    CONTROLS:vcontrol1 TYPE TABLEVIEW USING SCREEN '9002'.
    *start-of-selection.
    *&      Module  USER_COMMAND_9000  INPUT
          text
    MODULE USER_COMMAND_9000 INPUT.
    CASE sy-ucomm.
    WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.
    SET SCREEN 0.
    LEAVE SCREEN.
    CLEAR sy-ucomm.
    WHEN 'ENQUIRY'.
    perform multiple_selection.
    perform append_CUSTOMER_code.
    PERFORM SELECT_DATA.
    call screen '9001'.
    WHEN 'UPDATE'.
          perform append_CUSTOMER_code.
          PERFORM SELECT_DATA.
          call screen '9002'.
          perform update on commit.
    WHEN 'DELETE'.
          perform append_CUSTOMER_code.
          PERFORM SELECT_DATA.
          call screen '9002'.
    ENDCASE.
    ENDMODULE.                 " USER_COMMAND_9000  INPUT
    *&      Module  STATUS_9000  OUTPUT
          text
    MODULE STATUS_9000 OUTPUT.
      SET PF-STATUS 'ZCUSTOMER'.
    SET TITLEBAR 'xxx'.
    ENDMODULE.                 " STATUS_9000  OUTPUT
    *&      Module  USER_COMMAND_9001  INPUT
          text
    MODULE USER_COMMAND_9001 INPUT.
    CASE sy-ucomm.
    WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.
    SET SCREEN 0.
    LEAVE SCREEN.
    CLEAR sy-ucomm.
    endcase.
    ENDMODULE.                 " USER_COMMAND_9001  INPUT
    *&      Module  STATUS_9001  OUTPUT
          text
    MODULE STATUS_9001 OUTPUT.
      SET PF-STATUS 'ZCUSTOMER'.
    SET TITLEBAR 'xxx'.
    move itab-MANDT   to zcust_call_rec-MANDT.
    move itab-kunnr   to zcust_call_rec-kunnr.
    move itab-budat   to zcust_call_rec-budat.
    move itab-code    to zcust_call_rec-code.
    move itab-remarks to zcust_call_rec-remarks.
    vcontrol-lines = sy-dbcnt.
    ENDMODULE.                 " STATUS_9001  OUTPUT
    *&      Module  USER_COMMAND_9002  INPUT
          text
    module  USER_COMMAND_9002 input.
    CASE sy-ucomm.
       WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.
          SET SCREEN 0.
          LEAVE SCREEN.
          CLEAR sy-ucomm.
       WHEN 'UPDATE'.
             perform move_data.
         UPDATE ZCUST_CALL_REC FROM TABLE ITAB.
            IF SY-SUBRC = 0.
               MESSAGE I000(0) WITH 'RECORDS ARE UPDATED'.
             ELSE.
               MESSAGE E001(0) WITH 'RECORDS ARE NOT UPDATED'.
            ENDIF.
      WHEN 'DELETE'.
             perform move_data.
             DELETE ZCUST_CALL_REC FROM TABLE ITAB.
              IF SY-SUBRC = 0.
               MESSAGE I000(0) WITH 'RECORDS ARE DELETED'.
             ELSE.
               MESSAGE E001(0) WITH 'RECORDS ARE NOT DELETED'.
            ENDIF.
    endcase.
    endmodule.                 " USER_COMMAND_9002  INPUT
    *&      Module  STATUS_9002  OUTPUT
          text
    module STATUS_9002 output.
      SET PF-STATUS 'ZCUSTOMER1'.
    SET TITLEBAR 'xxx'.
    endmodule.                 " STATUS_9002  OUTPUT
    *&      Module  update_table  OUTPUT
          text
    module update_table output.
         move itab-MANDT   to zcust_call_rec-MANDT.
         move itab-kunnr   to zcust_call_rec-kunnr.
         move itab-budat   to zcust_call_rec-budat.
         move itab-code    to zcust_call_rec-code.
         move itab-remarks to zcust_call_rec-remarks.
    vcontrol-lines = sy-dbcnt.
    endmodule.                 " update_table  OUTPUT
    ***Selection Data
    FORM SELECT_DATA.
    SELECT  mandt kunnr budat code remarks  FROM zcust_call_rec INTO
                            table itab
                             WHERE kunnr IN r_kunnr AND BUDAT IN R_BUDAT.
    ENDFORM.
    ****append vendor code
    FORM APPEND_CUSTOMER_CODE.
    clear r_kunnr.
    clear itab.
    clear r_budat.
    refresh r_kunnr.
    refresh itab.
    refresh r_kunnr.
    IF r_kunnr  IS INITIAL
                  AND NOT v_kun_low IS INITIAL
                   AND NOT v_kun_high IS INITIAL.
                        CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
                                    EXPORTING
                                       input         = v_kun_low
                                    IMPORTING
                                       OUTPUT        = r_kunnr-low.
                       CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
                                  EXPORTING
                                      input         = v_kun_high
                                  IMPORTING
                                      OUTPUT        = r_kunnr-high.
                     r_kunnr-option = 'BT'.
                     r_kunnr-sign = 'I'.
                     append r_kunnr.
       PERFORM V_BUDAT.
    ELSEIF r_kunnr  IS INITIAL
                  AND NOT v_kun_low IS INITIAL
                   AND  v_kun_high IS INITIAL.
                        CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
                                    EXPORTING
                                       input         = v_kun_low
                                    IMPORTING
                                       OUTPUT        = r_kunnr-low.
                    r_kunnr-SIGN = 'I'.
                    r_kunnr-OPTION = 'EQ'.
                    APPEND r_kunnr.
       PERFORM V_BUDAT.
    ELSEIF r_kunnr IS INITIAL
                  AND  v_kun_low IS INITIAL
                   AND NOT v_kun_high IS INITIAL.
                        CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
                                    EXPORTING
                                       input         = v_kun_low
                                    IMPORTING
                                       OUTPUT        = r_kunnr-low.
                    r_kunnr-SIGN = 'I'.
                    r_kunnr-OPTION = 'EQ'.
                    APPEND r_kunnr.
          PERFORM V_BUDAT.
    ELSEIF r_kunnr IS INITIAL
                  AND  v_kun_low IS INITIAL
                   AND  v_kun_high IS INITIAL.
                        IF SY-SUBRC = 0.
                             MESSAGE I003(0) WITH 'ENTER CUSTOMER NUMBER'.
                              CALL SCREEN '9000'.
                        ENDIF.
    PERFORM V_BUDAT.
    ENDIF.
    ENDFORM.
    FORM V_BUDAT.
    IF  R_BUDAT IS INITIAL
                   AND NOT v_BUD_low IS INITIAL
                   AND NOT v_BUD_high IS INITIAL.
                     r_budat-low = v_bud_low.
                     r_budat-high = v_bud_high.
                     r_budat-option = 'BT'.
                     r_budat-sign = 'I'.
                     append r_budat.
             ELSEIF  R_BUDAT IS INITIAL
                   AND NOT v_BUD_low IS INITIAL
                   AND  v_BUD_high IS INITIAL.
                     r_budat-low = v_bud_low.
                     r_budat-high = v_bud_high.
                     r_budat-option = 'EQ'.
                     r_budat-sign = 'I'.
                     append r_budat.
             ELSEIF  R_BUDAT IS INITIAL
                   AND  v_BUD_low IS INITIAL
                   AND NOT v_BUD_high IS INITIAL.
                     r_budat-HIGH = v_bud_HIGH.
                     r_budat-option = 'EQ'.
                     r_budat-sign = 'I'.
                     append r_budat.
              ELSEIF  R_BUDAT IS INITIAL
                   AND  v_BUD_low IS INITIAL
                   AND  v_BUD_high IS INITIAL.
                   IF SY-SUBRC = 0.
                       MESSAGE I002(0) WITH 'ENTER POSTING DATE'.
                      CALL SCREEN '9000'.
                    r_budat-low = ''.
                    r_budat-option = ''.
                    r_budat-sign = ''.
                    ENDIF.
            ENDIF.
    ENDFORM.
    *&      Form  update
          text
    -->  p1        text
    <--  p2        text
    form update .
    commit work.
    endform.                    " update
    *&      Form  move_data
          text
    -->  p1        text
    <--  p2        text
    form move_data .
       clear itab.
      refresh itab.
           move-corresponding  zcust_call_rec to itab.
           MOVE ZCUST_CALL_REC-MANDT   TO ITAB-MANDT.
           MOVE ZCUST_CALL_REC-KUNNR   TO ITAB-KUNNR.
           MOVE ZCUST_CALL_REC-BUDAT   TO ITAB-BUDAT.
           MOVE ZCUST_CALL_REC-CODE    TO ITAB-CODE.
           MOVE ZCUST_CALL_REC-REMARKS TO ITAB-REMARKS.
         APPEND ITAB.
         delete itab where kunnr is initial.
    endform.                    " move_data
    thanks in adv
    vidya

  • Update User Defined Field using DBDataSource

    Hi All,
    I'm trying to update the user defined field using the DBDataSource object.  However an error occurred - "Item is not a User-Defined Field".
    The code used is as follows:
    Dim oDS as SAPbouiCOM.DBDataSource
    Dim oForm as SAPbouiCOM.Form
    Set oForm = SBO_Application.Forms.GetForm("139", 1)
    Set oDS = oForm.DataSources.DBDataSources.Item("ORDR")
    oDS.SetValue("U_Field1",oDS.Offset,"abc")
    Please help.

    If you haven´t put the field directly in the standard form the user defined fields are in a different form. This form has the same type but with "-" before it.
    So so should use this code to get the user defined fields form:
    Set oForm = SBO_Application.Forms.GetForm("-139", 1)
    Maybe this can be the cause

  • Update field LSMNG in MIGO transaction using bapi bapi_goodsmvt_create

    Hi ,
       I am using bapi bapi_goodsmvt_create  for creating goods receipt against purchase order in which I have to update field LSMNG i.e. Del. Note Qty. But this field is not there in BAPI input parameters/table fields.
    How i can update this field using the same bapi
    Thanks and regards
    Deepak Sharma

    Hi,
       Can I update this field using BAPI bapi_goodsmvt_create.
    thanks
    Deepak

  • Can we update InfoPath field using Event Receiver ItemAdded method

    Hi,
    Can we update InfoPath browser enabled form field using Event Receiver ItemAdded method. Following is the code snippet I used to update the field but it's not updating the field.
    Please help me on this issue.
    public override void ItemAdded(SPItemEventProperties properties)
                base.ItemAdded(properties);
                try
                    //Turn off event firing so we don't end up with a conflict 
                    base.EventFiringEnabled = false;
                    //Run the code elevated so we can rename our item
                    SPSecurity.RunWithElevatedPrivileges(delegate()
                        using (SPSite site = new SPSite(properties.Web.Site.ID))
                            using (SPWeb web = site.OpenWeb(properties.Web.ID))
                                //Grab a new copy of our list and listitem under the new security context
                                SPList list = web.Lists[properties.List.ID];
                                SPListItem item = list.Items.GetItemById(properties.ListItemId);
                                //Change name and title to match item ID
                                item.File.CheckOut();
                                string fieldInternalName = properties.List.Fields["Employee Name"].InternalName;
                                SPUser oUser = web.EnsureUser(Convert.ToString(item["Employee Entry"]).Substring(0, Convert.ToString(item["Employee Entry"]).Length - 2));
                                item[fieldInternalName] = oUser.Name;
                                item.Update();
                                item.File.CheckIn("Changed Employee Name");
                catch (Exception ex)
                    //Log an errors to the ULS
                finally
                    //Turn event firing back on
                    base.EventFiringEnabled = true;
    Srivignesh J

    When you published your infopath form, did you promote the field you are trying to update to a property, and allow updates (its one of the steps in publishing your form, where you pick which fields you want to show as fields in the list view)... 
    Otherwise, how about get the Item.SPFile object, open it as XML, find the field you want to update, and update it that way... 

  • How to auto update date column without using trigger

    Hi,
    How to write below MYSQL query in Oracle 10g :
    CREATE TABLE example_timestamp (
    Id number(10) NOT NULL PRIMARY KEY,
    Data VARCHAR(100),
         Date_time TIMESTAMP DEFAULT current_timestamp on update current_timestamp
    I need to auto update the Date_Time column without using trigger when ever i update a record.
    Example shown below is from MYSQL. I want to perform the below steps in ORACLE to auto update Date_Time column.
    mysql> INSERT INTO example_timestamp (data)
    VALUES ('The time of creation is:');
    mysql> SELECT * FROM example_timestamp;
    | id | data | Date_Time |
    | 1 | The time of creation is: | 2012-06-28 12:37:22 |
    mysql> UPDATE example_timestamp
    SET data='The current timestamp is: '
    WHERE id=1;
    mysql> SELECT * FROM example_timestamp;
    | id | data | Date_Time |
    | 1 | The current timestamp is: | 2012-06-28 12:38:55 |
    Regards,
    Yogesh.

    Is there no functionality in oracle to auto update date column without using trigger??
    I dont want to update the date column in UPDATE statement.
    The date column should automatically get updated when ever i execute an Update statement.

  • ESS Leave Custom fields, how to update them using BADIs

    Hi There,
    We are trying to use custom fields provided in ESS leave application, and we want to update them using BADI. As these information is not available on the screen while requesting leave request.
    I did look at PT_ABS_REQ BADI and seems i can use Post_Vio_BLOP .. but its unable to update table PTREQ_ATTABSDATA .
    Can you please suggest what can be best approach here.
    Thanks a lot.
    Rgds,

    Sudhir wrote:>
    > I did look at PT_ABS_REQ BADI and seems i can use Post_Vio_BLOP .. but its unable to update table PTREQ_ATTABSDATA .
    Did you look at using the Implict Enhancement Options available at the beginning & end of the POST_VIA_BLOP Method? Or even better, enhance the Class CL_PT_ARQ_REQ_EXIT & replace the IF_EX_PT_ABS_REQ~POST_VIA_BLOP Method with an Overwrite Exit?
    ~Suresh

  • Sum Currency Fields using Workflow Field Update

    Trying to have a workflow rule that updates a field "Total Payments" when any of the "Payment" amount fields change.
    Created the workflow rule like this:
    PRE('<cPayment1_ITAG>')<>[<cPayment1_ITAG>] OR PRE('<cPayment2_ITAG>')<>[<cPayment2_ITAG>] OR PRE('<cPayment3_ITAG>')<>[<cPayment3_ITAG>]
    And the Update Field Value rule as follows:
    =[<cPayment1_ITAG>]+[<cPayment2_ITAG>]+[<cPayment3_ITAG>]
    But it doesn't want to work. Should I use "FieldValue" function for the update rule?
    Thanks,
    Dan

    That worked perfectly, thanks Mani!
    I've seen where people have mentioned using the "=" sign or no "=" sign but I'm not sure most people understand the proper use of when to use it versus when not to. Can anyone elaborate on the cases when an equal sign should be used versus when it shouldn't be used?
    I personally would like to have a bit more knowledge regarding these types of idiosyncrasies of the syntax.
    Dan

  • Ho w to create a field using workflow ?

    how to create a field using workflow ?

    Hi,
    According to your description, my understanding is that you want to trigger a workflow only once when a item is updated.
    If you want to set it programmatically, I suggest you can create a Yes/NO column called flag firstly with the default value No and set the workflow start option to manually start.
    When updating the list item, you can create a ItemUpdated Event Receiver to track the update action, and in the event, you can judge the flag column value, if the value is No, then you can trigger the workflow programmatically and in the end of code set
    the code to Yes ,if the value is Yes, then not trigger the workflow.
    Here are some detailed code demos for your reference:
    How to set and read value of Yes/No column programmatically?
    How
    to programmatically start sharepoint workflow
    How to create an event receiver
    Thanks
    Best Regards
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

Maybe you are looking for