Results 1 to 6 of 6
  1. #1
    Join Date
    Jan 2004
    Posts
    153

    Smile Unanswered: Oracle D2k Forms

    Hi All,

    In a Oracle From, there is a Multi record Data block ( Tabular Layout )
    and in that block there is a check box item having following properties :
    Checked value : Y
    Unchecked value : N
    Initial value : Y

    Now my requirement is, at a time the block will display this checked box item as checked, only for one record. I mean , let say right now the 3-rd one is checked, and user click on the 5-th record to make it checked , now 5-th one will be checked and 3-rd one will be automatically unchecked.

    Looking for your helps.

    Thanks

    JD

  2. #2
    Join Date
    Mar 2004
    Location
    California
    Posts
    58
    Ok lets see if I am getting this right, so you are displaying say 3 records at a time then it should look like this right


    Column 1 | Col2(checkbox)
    ----------------------------------
    val1 | checked
    val2 | unchecked
    val3 | checked

    If this is what you want, then make the checkbox part of the data block that yout data record is in. Since the layout of that data block is table layout your checkboxes should appear corresponding to each record as well. Most probably you have created this checkbox as not part of this data block.

    Hope it helps, however if I understood your problem incorrectly please explain it greater detail.

  3. #3
    Join Date
    Jan 2004
    Posts
    153
    Thanks for the reply.
    But my requirement is , in to the table the the value for Col2 (which is the checkbox item ) will be 'Y' for only for one record and for rest it will be 'N'.
    Using the form if user select one unchecked ( i.e.'N' value) then that value will change from 'N' to 'Y' and it will be now checked one and the current 'Y' will be now 'N' and that will be now uncheked.

  4. #4
    Join Date
    Mar 2004
    Location
    California
    Posts
    58
    Hmmm...this seems sorta odd....do you mind telling me why this is so. I mean given that you are dispaying different rows, you mean to say that the check box should be yes for only on of the rows and no for all the others? This doesnt make sense, cuz what if next time you wanna display 6 rows at a time? What if the user puts a condition that matches all the rows in your table, in that case are you sating that only one checkbox can have the value yes while the rest say no? If you dont mind can you please explain the underlying table structure? Also i am assuming that the value for the checkbox is coming from the table and then going back into the table right? So it appears that what you want is that only one row in the table should be able to have the value Y in that column. In that case may i suggest that you use a trigger on the form level. If a user changes the value of a check box (this is the event) then you go on and check if the new value is checked and if it is then take approprite steps. Still I dont see why you are doing this, i mena what if a user changes the only checked checkbox to No, what happens then?

  5. #5
    Join Date
    Jan 2004
    Posts
    153
    Yah !!! you are right. See ,in the entire table ony one record can have the value ' Y ' and rest are ' N ' for the column which is a checkbox item into the form.So that's why for always display chekced item only for one record . if user select one uncheked value then form will set ' Y ' for that column and for rest it will set ' N '.

    Any way , I have solved the problem....

    you can see the code :
    Field: CB_primary_ind
    Trigger : When-CheckeBox_Changed
    Code :
    DECLARE
    l_record varchar2(3);
    BEGIN
    if : supply.primary_ind = 'Y' then
    l_record := :system.cursor_record;
    first_record;
    loop
    if :system.cursor_record <> l_record then
    : supply.primary_ind := 'N';
    end if;
    if :system.last_record = 'TRUE' then
    exit;
    end if;
    next_record;
    end loop;
    go_record(:system.cursor_record);
    end if;
    END;


    Thanks

    JD

  6. #6
    Join Date
    Mar 2004
    Location
    California
    Posts
    58
    I am glad you got it working......actually its been a learning experience for me too, cuz I was wondering how you would access all the other records in the table. Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •