Home » Developer & Programmer » Forms » duplicate entry
duplicate entry [message #347812] Sun, 14 September 2008 03:22 Go to next message
sajidrazmi
Messages: 47
Registered: August 2008
Location: oman
Member
hi dear,
i am in one problem i have two block in one block there is data and that block is not a dtabase block in this block i create radio button
present (p)
leave (L)
absent (a)
when user click present that particular employee data go to another block which is database block so i have create one procedure for restrict duplicate entry duplicate entry has been restricted but when user click leave or absent butoon only status has changed so i want if one entry has done user could not do entry
i have written these code and i call to my button
PROCEDURE proc_duplicate
IS
   check1   VARCHAR2 (6);
   check2   VARCHAR2 (30);
   fail     VARCHAR2 (1)  := 'N';
BEGIN
   check1 := :asg_tas.tas_emp_code;
   check2 := :asg_tas.tas_emp_name;
   GO_BLOCK ('ASG_TAS');
   FIRST_RECORD;

   WHILE (:SYSTEM.LAST_RECORD <> 'TRUE') AND (fail = 'N')
   LOOP
      IF check1 = :asg_tas.tas_emp_code AND check2 = :asg_tas.tas_emp_name
      THEN
         fail := 'Y';
      ELSE
         NEXT_RECORD;
      END IF;
   END LOOP;
END;


please help me out of this problem
thanks & Regards

[EDITED by LF: removed [code] tags that were encapsulating every single code line and reformatted the procedure in order to make it readable]

[Updated on: Sun, 14 September 2008 06:03] by Moderator

Report message to a moderator

Re: duplicate entry [message #347822 is a reply to message #347812] Sun, 14 September 2008 06:07 Go to previous messageGo to next message
Littlefoot
Messages: 20901
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Please, read and follow guidelines available in the OraFAQ Forum Guide.

I have reformatted procedure code, but I can not (and do not want to) read your mind, trying to figure out where your thoughts (sentences) begin or end.

Punctuation exists - use it! I can live without capital letter at the beginning of a sentence, but can't stand endless sentences.

Therefore, reformat your message so that we (OK, I) could understand the problem.
Re: duplicate entry [message #347893 is a reply to message #347822] Sun, 14 September 2008 23:50 Go to previous messageGo to next message
sajidrazmi
Messages: 47
Registered: August 2008
Location: oman
Member
Hi Dear,
Thank you very much for giving Me response
Actually Problem is that when i call this procdeure to my When-Button-Presed Trigger it could not do the same Employee Code and calculation But when User Press The Radio Button Like
Absent or Leave only That Partuculr Status of Employee Has Change But I donot Want To do That If user First Select Present status Then the Same Employee Should not Be change If he want To change it.

Here I have Called The procedure;
DECLARE
  MY_CURRENT_VALUE   VARCHAR (30);
  CUR_BLK            VARCHAR2 (80) := :SYSTEM.CURSOR_BLOCK;
  CUR_REC            NUMBER;
  BLK_ID             BLOCK;
  TOT_HRS            VARCHAR2 (12) := '9:0';
BEGIN
  BLK_ID            := FinD_BLOCK (CUR_BLK);
  CUR_REC           := GET_BLOCK_PROPERTY (BLK_ID, CURRENT_RECORD);
  MY_CURRENT_VALUE  := :BLK_TAS_TEMP.TAS_TEMP_EMP_CODE;
  GO_BLOCK ('BLK_TAS_TEMP');
  SET_ITEM_INSTANCE_PROPERTY ('BLK_TAS_TEMP.TAS_TEMP_EMP_CODE',
                              CURRENT_RECORD,
                              VISUAL_ATTRIBUTE,
                              'CUR_ROW');
  SET_ITEM_INSTANCE_PROPERTY ('BLK_TAS_TEMP.TAS_TEMP_EMP_NAME',
                              CURRENT_RECORD,
                              VISUAL_ATTRIBUTE,
                              'CUR_ROW');
  SET_ITEM_INSTANCE_PROPERTY ('BLK_TAS_TEMP.TAS_TEMP_MORNING_IN',
                              CURRENT_RECORD,
                              VISUAL_ATTRIBUTE,
                              'CUR_ROW');
  SET_ITEM_INSTANCE_PROPERTY ('BLK_TAS_TEMP.TAS_TEMP_LUNCH_OUT',
                              CURRENT_RECORD,
                              VISUAL_ATTRIBUTE,
                              'CUR_ROW');
  SET_ITEM_INSTANCE_PROPERTY ('BLK_TAS_TEMP.TAS_TEMP_TOT_MORNING',
                              CURRENT_RECORD,
                              VISUAL_ATTRIBUTE,
                              'CUR_ROW');
  SET_ITEM_INSTANCE_PROPERTY ('BLK_TAS_TEMP.TAS_TEMP_POST_LUNCH_IN',
                              CURRENT_RECORD,
                              VISUAL_ATTRIBUTE,
                              'CUR_ROW');
  SET_ITEM_INSTANCE_PROPERTY ('BLK_TAS_TEMP.TAS_TEMP_EVENING_OUT',
                              CURRENT_RECORD,
                              VISUAL_ATTRIBUTE,
                              'CUR_ROW');
  SET_ITEM_INSTANCE_PROPERTY ('BLK_TAS_TEMP.TAS_TEMP_TOT_EVENING',
                              CURRENT_RECORD,
                              VISUAL_ATTRIBUTE,
                              'CUR_ROW');
  SET_ITEM_INSTANCE_PROPERTY ('BLK_TAS_TEMP.TAS_TEMP_TOT_HRS',
                              CURRENT_RECORD,
                              VISUAL_ATTRIBUTE,
                              'CUR_ROW');
  SET_ITEM_INSTANCE_PROPERTY ('BLK_TAS_TEMP.TAS_TEMP_STATUS',
                              CURRENT_RECORD,
                              VISUAL_ATTRIBUTE,
                              'CUR_ROW');
  SET_ITEM_INSTANCE_PROPERTY ('BLK_TAS_TEMP.TAS_TEMP_OT',
                              CURRENT_RECORD,
                              VISUAL_ATTRIBUTE,
                              'CUR_ROW');
  SET_ITEM_INSTANCE_PROPERTY ('BLK_TAS_TEMP.TAS_TEMP_EMP_NAME',
                              CURRENT_RECORD,
                              VISUAL_ATTRIBUTE,
                              'CUR_ROW');
  SET_ITEM_INSTANCE_PROPERTY ('BLK_TAS_TEMP.TAS_TEMP_REMARKS',
                              CURRENT_RECORD,
                              VISUAL_ATTRIBUTE,
                              'CUR_ROW');
  IF :BLK_TAS_TEMP.TAS_TEMP_EMP_CODE IS NULL THEN
    DISP_ALERT ('There Is No Data');
    RAISE FORM_TRIGGER_FAILURE;
  ELSE
    MAKE_BLOCK_UPDATE_ALLOW ('ASG_TAS');
    GO_BLOCK ('ASG_TAS');
    LAST_RECORD;
    NEXT_RECORD;
    :ASG_TAS.TAS_EMP_CODE       := :BLK_TAS_TEMP.TAS_TEMP_EMP_CODE;
    :ASG_TAS.TAS_EMP_NAME       := :BLK_TAS_TEMP.TAS_TEMP_EMP_NAME;
    :ASG_TAS.TAS_MORNING_IN     := :BLK_TAS_TEMP.TAS_TEMP_MORNING_IN;
    :ASG_TAS.TAS_LUNCH_OUT      := :BLK_TAS_TEMP.TAS_TEMP_LUNCH_OUT;
    :ASG_TAS.TAS_TOT_MORNING    := :BLK_TAS_TEMP.TAS_TEMP_TOT_MORNING;
    :ASG_TAS.TAS_POST_LUNCH_IN  := :BLK_TAS_TEMP.TAS_TEMP_POST_LUNCH_IN;
    :ASG_TAS.TAS_EVENING_OUT    := :BLK_TAS_TEMP.TAS_TEMP_EVENING_OUT;
    :ASG_TAS.TAS_TOT_EVENING    := :BLK_TAS_TEMP.TAS_TEMP_TOT_EVENING;
    :ASG_TAS.TAS_TOT_HRS        := :BLK_TAS_TEMP.TAS_TEMP_TOT_HRS;
    :ASG_TAS.TAS_OT_HRS         := :BLK_TAS_TEMP.TAS_TEMP_OT;
    :ASG_TAS.TAS_REMARKS        := :BLK_TAS_TEMP.TAS_TEMP_REMARKS;
    :ASG_TAS.TAS_COMP_CODE      := :GLOBAL.M_COMP_CODE;
    :ASG_TAS.TAS_DEPT_CODE      := :BLK_PARA.TAS_DEPT_CODE;
    :ASG_TAS.TAS_ATT_DATE       := :BLK_PARA.TAS_DATE;
    :ASG_TAS.TAS_AUTH_DATE      := :PARAMETER.SYS_DATE;
  END IF;
  IF :SYSTEM.FORM_STATUS = 'CHANGED' THEN
    :ASG_TAS.TAS_AUTH_DATE  := :PARAMETER.SYS_DATE;
  END IF;
  IF :BLK_PARA.RG_STATUS = 'P' THEN
    :ASG_TAS.TAS_STATUS  := 'P';
  END IF;
  IF     :ASG_TAS.TAS_STATUS = 'P'
     AND :ASG_TAS.TAS_MORNING_IN IS NULL
     AND :ASG_TAS.TAS_LUNCH_OUT IS NULL
     AND :ASG_TAS.TAS_TOT_MORNING IS NULL
     AND :ASG_TAS.TAS_POST_LUNCH_IN IS NULL
     AND :ASG_TAS.TAS_EVENING_OUT IS NULL
     AND :ASG_TAS.TAS_TOT_EVENING IS NULL
     AND :ASG_TAS.TAS_TOT_HRS IS NULL THEN
    :ASG_TAS.TAS_MORNING_IN     := '08:00 AM';
    :ASG_TAS.TAS_LUNCH_OUT      := '01:00 PM';
    :ASG_TAS.TAS_TOT_MORNING    := '5:0';
    :ASG_TAS.TAS_POST_LUNCH_IN  := '02:00 PM';
    :ASG_TAS.TAS_EVENING_OUT    := '06:00 PM';
    :ASG_TAS.TAS_TOT_EVENING    := '4:0';
    :ASG_TAS.TAS_TOT_HRS        := TOT_HRS;
  END IF;
  IF :BLK_PARA.RG_STATUS = 'A' THEN
    :ASG_TAS.TAS_STATUS         := 'A';
    :ASG_TAS.TAS_MORNING_IN     := NULL;
    :ASG_TAS.TAS_LUNCH_OUT      := NULL;
    :ASG_TAS.TAS_TOT_MORNING    := NULL;
    :ASG_TAS.TAS_POST_LUNCH_IN  := NULL;
    :ASG_TAS.TAS_EVENING_OUT    := NULL;
    :ASG_TAS.TAS_TOT_EVENING    := NULL;
    :ASG_TAS.TAS_TOT_HRS        := NULL;
  END IF;
  IF :BLK_PARA.RG_STATUS = 'L' THEN
    :ASG_TAS.TAS_STATUS         := 'L';
    :ASG_TAS.TAS_MORNING_IN     := NULL;
    :ASG_TAS.TAS_LUNCH_OUT      := NULL;
    :ASG_TAS.TAS_TOT_MORNING    := NULL;
    :ASG_TAS.TAS_POST_LUNCH_IN  := NULL;
    :ASG_TAS.TAS_EVENING_OUT    := NULL;
    :ASG_TAS.TAS_TOT_EVENING    := NULL;
    :ASG_TAS.TAS_TOT_HRS        := NULL;
  END IF;
  MAKE_BLOCK_QUERY_ONLY ('ASG_TAS');
  PROC_DUPLICATE;
END;

[EDITED by DJM: fixed mega-crappy formatting]

[Updated on: Mon, 15 September 2008 02:32] by Moderator

Report message to a moderator

Re: duplicate entry [message #347942 is a reply to message #347893] Mon, 15 September 2008 02:34 Go to previous message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
Stop with the 'every word has a capital'. It pisses people off and YOU are the one wanting an answer.

Why not insert the data into a table in the database, go to the next block and do an 'execute_query' to display it. Put a unique index on the table and if the entry already exists you have the choice of either telling the user that is exists or tell them nothing and just display the existing record.

David
Previous Topic: different parameter and also successfully compile !!!
Next Topic: CANNOT START ANOTHER CALL FORM error
Goto Forum:
  


Current Time: Thu Dec 08 20:11:27 CST 2016

Total time taken to generate the page: 0.09423 seconds