This discussion is archived
10 Replies Latest reply: Jan 30, 2013 11:58 AM by 986451 RSS

Check Box field initial value is not assigned

986451 Newbie
Currently Being Moderated
Hi,

I have a custom form with 2 fields of which one is a check box which has below values
Value when checked: 1
Value when unchecked: 0
Check Box mapping of other values : Checked

and the other one is a text field. Requirement is to insert the text field data of the fields into db table which are checked.

Number iof record shown in the canvas is 10.


I am using the the below code in KEY-COMMIT trigger for saving the data into table. i.e., i am inserting the text field value into table for the check box which are checked

GO_BLOCK ('CHANNELS');
first_record;
LOOP
IF :CHANNELS.CHECK = 1 THEN
INSERT into ........
EXIT WHEN :SYSTEM.LAST_RECORD = 'TRUE';
NEXT_RECORD;
END LOOP;
COMMIT;
END;


The problem is the check box value is always null and records are not getting inserted into the table. Is there anywhere else we need to specify the initial check box value. Not sure why the check box value becomes null even though the check box ix checked.

Thanks,
Yuvaraaj.
  • 1. Re: Check Box field initial value is not assigned
    Michael Ferrante (Oracle) Guru Moderator
    Currently Being Moderated
    Try adding a SYNCHRONIZE after the GO_BLOCK. For example:
    GO_BLOCK ('CHANNELS');
    SYNCHRONIZE;  -- Suggested by Oracle
    first_record;
    LOOP 
    ... 
  • 2. Re: Check Box field initial value is not assigned
    986451 Newbie
    Currently Being Moderated
    Hi Michael,

    Tried SYNCHRONIZE.
    Didnt work. Still the value of checkbox is null.

    Thanks,
    Yuvaraaj.
  • 3. Re: Check Box field initial value is not assigned
    MLBrown Journeyer
    Currently Being Moderated
    Are you sure the checkbox value is null? Did you show the value in a MESSAGE built-in while it was going through the loop or did you run it in debug and see what the value is?

    Is CHANNELS a database block or a non-database block? If it is a database block, what is the name of the table?

    What is your actual INSERT statement?
  • 4. Re: Check Box field initial value is not assigned
    CraigB Guru
    Currently Being Moderated
    What do you have listed for the Initial Value property of your checkbox?

    Craig...
  • 5. Re: Check Box field initial value is not assigned
    986451 Newbie
    Currently Being Moderated
    Hi Brown,

    Yes, the check box value comes as null. I verified by using message as well as debug and iam getting null value for the checkbox.

    The Channel is a non database block, which has 2 items=> 1. Channel Name 2. Checkbox

    I have a master database block which has all field say item name, description, promotion code, date etc.

    My requirement is.. In the form, i enter the item details and select multiple channel. When click on save. multiple record should be inserted in to the table for each channel.

    So i am choosing the insert based on the checkbox value.

    Need your help / idea to solve this issue.

    Thanks in advance.

    Yuvaraaj.
  • 6. Re: Check Box field initial value is not assigned
    HamidHelal Guru
    Currently Being Moderated
    983448 wrote:
    Hi,

    I have a custom form with 2 fields of which one is a check box which has below values
    Value when checked: 1
    Value when unchecked: 0
    Check Box mapping of other values : Checked

    and the other one is a text field. Requirement is to insert the text field data of the fields into db table which are checked.

    Number iof record shown in the canvas is 10.


    I am using the the below code in KEY-COMMIT trigger for saving the data into table. i.e., i am inserting the text field value into table for the check box which are checked

    GO_BLOCK ('CHANNELS');
    first_record;
    LOOP
    IF :CHANNELS.CHECK = 1 THEN
    INSERT into ........
    EXIT WHEN :SYSTEM.LAST_RECORD = 'TRUE';
    NEXT_RECORD;
    END LOOP;
    COMMIT;
    END;


    The problem is the check box value is always null and records are not getting inserted into the table. Is there anywhere else we need to specify the initial check box value. Not sure why the check box value becomes null even though the check box ix checked.
    Hi Yuvaraaj
    You open thread at forum but don't close, it seems your all question are difficult to forum exparts ;)
    What is the data type of the check box ? and the length ?
    it should number and length should 1 or more
    set default value 0
    set database item to NO
    and don't use commit
    use in this case
    forms_ddl('commit');
    Hope this helps...


    Hamid
  • 7. Re: Check Box field initial value is not assigned
    986451 Newbie
    Currently Being Moderated
    Hi,

    The Initial Value of the check box was null. I entered the initial value as 1. It works now.

    Thanks a lot for the prompt reply.


    Thanks,
    Yuvaraaj.
  • 8. Re: Check Box field initial value is not assigned
    986451 Newbie
    Currently Being Moderated
    Hi Hamid,

    I need a last help from you from this form. Have achieved all functionalities in the form with the help of forum experts like you.

    After i made the manual inserti can a form message on the bottom saying "frm-40401 no changes to save in oracle" when i click on the standard button.
    Then i added :SYSTEM.MESSAGE_LEVEL := 5; in the pre-form trigger and no message was shown.

    I need to display a message like FRM-40400: Transaction complete: 1 records applied and saved.

    In which trigger should i Where this custom message to make it appears like a standard save functionality.

    Thanks in Advance.
    Yuvaraaj.
  • 9. Re: Check Box field initial value is not assigned
    HamidHelal Guru
    Currently Being Moderated
    983448 wrote:
    Hi Hamid,

    I need a last help from you from this form. Have achieved all functionalities in the form with the help of forum experts like you.

    After i made the manual inserti can a form message on the bottom saying "frm-40401 no changes to save in oracle" when i click on the standard button.
    Then i added :SYSTEM.MESSAGE_LEVEL := 5; in the pre-form trigger and no message was shown.

    I need to display a message like FRM-40400: Transaction complete: 1 records applied and saved.

    In which trigger should i Where this custom message to make it appears like a standard save functionality.
    Hi Yuvaraaj
    In your button after successful insertion into data base show your message like
    .......
    insert into ()
    values()
    ...........
    message('Transaction complete');
    message('Transaction complete');
    In addition if your wand to show how many record are inserted, use a counter in your loop and append the counter in your message. Like
    message('Transaction complete: '||V_COUNTER||' records applied and saved');
    message('Transaction complete: '||V_COUNTER||' records applied and saved');
    Hope this works.. ;)


    Hamid
  • 10. Re: Check Box field initial value is not assigned
    986451 Newbie
    Currently Being Moderated
    Hi Hamid,

    Did as you said. It worked perfectly.

    Thanks a lot..


    Thanks,
    Yuvaraaj.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points