Header Ads

  • Recent Post

    Tackling duplicate row issue in Position data CI

    When an app engine (AE) calls delivered Component Interface - CI_POSITION_DATA built from the POSITION_DATA component, the AE keeps abending without a proper reason.

    The error message thrown would be, "Data being added conflicts with existing data. (18,2)" Though the data processed would never cause such issues.

    Sometimes the AE(in turn CI) processes when ran only for one row and sometimes when run for fewer rows. In one of the sites my friend came through the below reason.

    We found that it was due to a trigger table in which a duplicate row occurred if a little bit of time doesn't transpire between saving the CIs.

    The reason why app engine abended sporadically is that there's a trigger table in which you would run into a duplicate row if a little bit oftime doesn't transpire between saving the CIs.

    The details on it are as follows.
    The table PS_BUDGET_TRIGGER is keyed by SETID, DEPTID, TRIGGER_RECORD and TIME_STAMP.
    The values are always the following:
    SETID == ""
    DEPTID == "KC001"
    TRIGGER_RECORD == "P"
    TIME_STAMP == Current Date/Time

    PS_BUDGET_TRIGGER is used by Budger Trigger page in Position Data component which causes this issue.

    The two solutions suggested:
    1) This table can ne modified by adding another key field. This would avoid the duplicate row problem. But we did not prefer to alter delivered table.

    2) The solution which worked fine: After every row of data was saved through a CI, the below code was called by a function:
    Function Delaysave()
    &t_time = %Datetime;
    &delay_time = AddToDateTime(&t_time, 0, 0, 0, 0, 0, 1);
    While True
    If %Datetime > &delay_time Then
    Break;
    End-If;
    End-While
    End-Function;

    1 comment:

    1. hi,
      tried to call ci_position_data ci but no new entry is added for the position_nbr. please advise why...the code i used "
      &MySession = %Session;
      &Position_CI = &MySession.GetCompIntfc(CompIntfc.CI_POSITION_DATA);
      If &Position_CI = Null Then
      errorHandler();
      rem Exit;
      End-If;

      rem **** set correction mode ****;
      &Position_CI.EditHistoryItems = True;
      &Position_CI.GetHistoryItems = True;

      rem ***** Set Component Interface Get/Create Keys *****;
      &Position_CI.POSITION_NBR = &sEE_POSITION_NBR;

      rem ***** Execute Get *****;
      If Not &Position_CI.Get() Then
      rem ***** No rows exist for the specified keys. Failed to get the Component Interface. *****;
      errorHandler();
      End-If;

      &Position_CI.save();

      ReplyDelete

    Please refrain for marketing messages and unnecessary back links.

    Post Top Ad

    Post Bottom Ad