7 Replies Latest reply: May 5, 2014 11:39 AM by Andreas Weiden RSS

    Looping Through Radio Group

    MoHaMeD.Ali

      Win 7 x64.
      Forms 6i,
      Hello Dears,

      I have radio group with nth number of radio buttons below it.
      i wanna on run time change prompt of all radio buttons in this radio group
      So, How can i loop through the radio group from the first radio button to the last one.

      there is  Built-in SET_RADIO_BUTTON_PROPERTY  but it requires the button name which i don't know it on the design time ,

        • 1. Re: Looping Through Radio Group
          sfr.farhan

          Hi,

           

          how are you defining/creating nth no. of radio buttons?

           

          I have radio group with nth number of radio buttons below it.,

          • 2. Re: Looping Through Radio Group
            MoHaMeD.Ali

            I'm typing standard code in attached library to run with the opening of the all forms.
            i get the prompts of the all items
            and after processes on theses prompt set it again.
            I'm looping on all item from the first item to the last item on the block
            and looping on a blocks through the form form the first block to the last block on the form
            so if the developer created a radio group with radio buttons under it
            I'm not in advance know the number of the buttons.
            like that

              V_CURRENT_ITEM:=GET_BLOCK_PROPERTY(V_CURR_BLOCK,FIRST_ITEM);
            ..
            ..

                 EXIT WHENGET_BLOCK_PROPERTY(V_CURR_BLOCK,LAST_ITEM)=V_CURRENT_ITEM;
            V_CURRENT_ITEM:=GET_ITEM_PROPERTY(V_CURR_BLOCK||'.'||V_CURRENT_ITEM,NEXTITEM);
              

              END LOOP;

            what can i do if the item is radio group

             

            • 3. Re: Looping Through Radio Group
              sfr.farhan

              I think, this is not possible with define built-in,

               

              Ref.

              How to navigate to the radio buttons programatically?

              • 4. Re: Looping Through Radio Group
                MoHaMeD.Ali

                Thanks alot

                • 5. Re: Looping Through Radio Group
                  Andreas Weiden

                  What exactly is the reason why you want to do this? Can you explain a little more?

                  • 6. Re: Looping Through Radio Group
                    MoHaMeD.Ali

                    i wanna some thing like that :
                    in when-new-form-instance
                    delare
                    v_original_prompt varchar2(25);

                    v_current_lang_prompt varchar2(25); ---- another language which the user logged with it
                    begin
                    v_original_prompt:=get_radio_button_property('radiogroup1','column1',label);

                    select decode(:global.language_id,'ARB',arabic_label,'FRC',french_label)
                    into v_current_lang_prompt

                    from text_prompts
                    where prompt_id=v_original_prompt;
                    get_radio_button_property('radiogroup1','column1',labe,v_current_lang_prompt);
                    end;

                     

                    ----------------------
                    but in Advance i don't know the number of the radio button in the radio group

                    i wanna to loop in all buttons automatically

                    in the previous example i used ''column1'
                    but really i don't know the names of the sub buttons or how many times i will loop the pervious code.



                    • 7. Re: Looping Through Radio Group
                      Andreas Weiden

                      I'm afraid this will not work for other cases too. For example, you cannot loop through the Lov-column-headers programmatically, you can not loop over alerts,....

                       

                      Also, doing a lookup on a prompt text is error-prown. What happens when you change the english prompt?

                       

                      An approach i took in the past uses the JDAPI. This java-api enables you to retrieve all info from a form. Unfortunately it is available in forms 10g and above. But you would only need it for the extraction of properties on one machine. In Forms 6i there is the C-api which has nearly the same capabilitites, but is more complex to handle (at least for me as a none-C guy).

                       

                      Steps to take (as overview):

                      1. Create metadata-tables to store the "Keys" of the different available forms-objects.

                      2. Write a PL/SQL-program which generates the necessary SET_XX_PROPERTY-statements to fill all items of a form at runtime. This program would read the metadata-tables as well.

                      3 .Extract all the possible properties using the JDAPI and insert it into the metadata-tables. Just leave the translation columns empty

                      4. Take the generated code and put it into the PRE-FORM-trigger of the specific form.

                       

                      Steps 3 and 4 will have to be repeated for each form and every time the form changes.