Creating Region & Items Dynamically based on SQL Result

Hi,
I need to create regions dynamically during runtime based on SQL.
So the number of regions and title will depends on the SQL result.
I came accross the PLSQL Dynamic Content region type. I searched in the internet, I could not find a matching example.
I looked at the APEX book, it mentions about 'Creating a Matrix of Fields Programmatically' but It's not very descriptive and it's using www_flow_api which i couldn't find documentation about it.
So I am turning into this forum for help.
Can you guys guide me to dynamically create region in a page?
for e.g
If my sql returns 5 records, I need to create 5 regions. Each region will contain a dynamically created tabular form as well depending on another SQL (from table function).
Please let me know if I am not being clear about my question.
Thanks a lot in advance.

hello,
I have the following SQL statement in my region.
SELECT APEX_ITEM.DISPLAY_AND_SAVE(1,rectype) rectype,
       APEX_ITEM.DISPLAY_AND_SAVE(2,class_id) class_id,
       APEX_ITEM.DISPLAY_AND_SAVE(3,attribute_id) attribute_id,
       decode(rectype,1,'<p style="font-size:17px;color:white;background-color:#383838">'||title||'</p>',
                      2,'<p><b><i><big>'||title||'</b></i></big></p>',
                      3,replace(title,chr(13)||chr(10),'</br>'),
                      apex_item.textarea(4,title,5,200)) title,
       decode(rectype,1,'<p style="font-size:17px;color:white;background-color:#383838">'||review1st||'</p>',
                      2,apex_item.text(5,review1st,3,3),
                      3,APEX_ITEM.SELECT_LIST_FROM_LOV(5,review1st,'ARTIST_RANK',null,'NO'),
                      apex_item.hidden(5,review1st)) review1st,
       decode(rectype,1,'<p style="font-size:17px;color:white;background-color:#383838">'||review2nd||'</p>',
                      2,apex_item.text(6,review2nd,3,3),
                      3,APEX_ITEM.SELECT_LIST_FROM_LOV(6,review2nd,'ARTIST_RANK',null,'NO'),
                      apex_item.hidden(6,review2nd)) review2nd
  FROM TABLE (pkg_artist_review.f_artist_review (:P21_ARTIST_SEQ, :P21_ARTIST_DISCIPLINE,:P21_REVIEW_YEAR))as you can see I use DECODE because I need to do HTML formatting on the value and create ITEM according to the value of 'rectype'
decode(rectype,1,'<p style="font-size:17px;color:white;background-color:#383838">'||title||'</p>',
                      2,'<p><b><i><big>'||title||'</b></i></big></p>',
                      3,replace(title,chr(13)||chr(10),'</br>'),
                      apex_item.textarea(4,title,5,200)) title, so the report result would look like
rectype                  title
[display f01]          title
[display f01]          title
[display f01]          title
[display f01]          [text area f04]My question is :
I would think my array list f01 and f04 will have different number of values inside.
f01 will have 4 value, whereas f04 will only have 1.
I tried to use
decode(rectype,1,APEX_ITEM.DISPLAY_AND_SAVE(4,'<p style="font-size:17px;color:white;background-color:#383838">'||title||'</p>'),
                      2,APEX_ITEM.DISPLAY_AND_SAVE(4,'<p><b><i><big>'||title||'</b></i></big></p>'),
                      3,APEX_ITEM.DISPLAY_AND_SAVE(4,replace(title,chr(13)||chr(10),'</br>')),
                      apex_item.textarea(4,title,5,200)) title, I only ended up having the HTML code written to the report.
How can I handle such situation?
I need my array list to have the same number of records thus i could just use one index to iterate through the value.
Thanks in advance.
Edited by: joel2 on Mar 18, 2009 3:40 PM

Similar Messages

  • How can I create UI components dynamically based on the result of WebService/HttpService call?

    I would like to create child components of the component
    based on a XML which is retrieved by WebService/HttpService call.
    createChildren() is the one to be used to create components
    dynamically. But if I use createChildren() and call a
    WS/HttpService request in createChildren method, I can not get the
    result of WS/HttpService request in createChildren().
    It seems that the result event is processed later after
    createChildren() is completed.
    How can I implement my requirement?
    I would appreciate any pointer or suggestion.
    Best regards
    Masa

    1) Use a List, with a custom itemRenderer
    2) Use a Repeater (Probably easiest)
    3) use Actionscript to addChild() components.
    Tracy

  • How to create internal table dynamically based on a table entry

    hi Experts,
      I have table yprod_cat. It has product categories.
      In my ABAP program I need to create internal table dynamically based on the number of entries in the table.
      For example:
      If the table has 3 entries for product category
      1. Board
      2. Micro
      3. Syst
    Then create three (3) internal tables.
    i_board
    i_micro
    i_syst
    How can we do this? Any sample code will be very usefull
    Thanks & Regards
    Gopal
    Moderator Message: No sample codes can be given. Please search for them or work it!
    Edited by: kishan P on Jan 19, 2011 4:22 PM

    Our APEX version is 4.2We are using below SQL query to display radio groups dynamically..
    SELECT APEX_ITEM.RADIOGROUP (1,deptno,'20',dname) dt
    FROM dept
    ORDER BY 1;
    Created a form using SQL type and given abouve SQL query as source.. But when we run the page, there were no radio groups displayed in the page..
    Below is the output of the query..
    <input type="radio" name="f01" value="10" />ACCOUNTING
    <input type="radio" name="f01" value="20" checked="checked" />RESEARCH
    <input type="radio" name="f01" value="30" />SALES
    <input type="radio" name="f01" value="40" />OPERATIONS
    >
    If Tabular Form:
    Edit Region > Report Attributes > Edit Column > Change the Column type to "Standard Report Column"
    If normal Page Item:
    Edit Page Item > Security > Escape special characters=No.
    Pl read the help on that page item to understand the security risk associated with =NO.
    Cheers,
    Edited by: Prabodh on Dec 3, 2012 5:59 PM

  • Set label of an item dynamically through pl/sql function

    Hi ,
    How Can I get the label of an item dynamically through a pl/sql function.
    I have a table that stores the label name for these items.
    I want to set the label for the item based on the value in my table ?
    Is it possible ?
    any ideas ?
    Thanks in advance,
    Dippy
    Edited by: Dippy on Feb 23, 2010 11:02 AM
    Edited by: Dippy on Feb 23, 2010 11:02 AM

    If I understand you correctly, you are using a standard report region, but want to dynamically name the column headers? The only way I've been able to get this to work is to create hidden items for each column header, calculate the value you want for each item, then reference the item in the column header using &item_X. for the column header name.
    The problem is that at this point, APEX doesn't allow for dynamic column naming unless you want to do everything yourself using a PL/SQL process that builds the report table manually. I've done that for certain complex reporting tools.
    I understand it's tedious to create all the column header items; I have one report that has over 72 items used in this way. It was a pain, but it got the job done.

  • Step by step procedure to create apex item dynamically

    Can anyone please guide me how to create apex item like textbox and do operations on that textbox?

    Pankaj Kumar wrote:
    I think you didn't understand my question, i want to create fields(checkboxes, textboxes) dynamically. For ex:If there are 3 records in table, i want three checkboxes in the page with different name each.You could use APEX_ITEM API in plsql dyanmic region within a case statement

  • Creating Query with dynamic columns to show results

    Hi experts,
    I need to know how to create a query with dynamic columns. Meaning, I don't want to create a query with fixed columns representing the 12 periods of the fiscal year to show me actuals as the fiscal year proceeds.
    For example, if I am currently in the middle of period 3 (March) of a fiscal year, when I execute the query, I need it to automatically only show me the 'Actuals' for periods 1 and 2, without seeing the columns from periods 3 to 12 showing blank.
    Then when I am in the middle period 5 (May) the query should ONLY show me the columns for periods 1 to 4 'Actuals', no results should be shown for periods 5 to 12 yet, and I don't want to even see blank columns for period 6 to 12.
    How do I define my columns, to achieve this.
    Maximum points will be awarded.
    Thanks Everyone.

    Hi Josh,
    I'm having a little difficuluty understanding what should be included in my restricted key figures.
    The time characteristics that I have available to use are:
    0FISCPER3 (posting period)
    0FISCYEAR (fiscal year), currently using SAP EXIT to default current fiscal year.
    0FISCVARNT (fiscal year variant).
    In addition, I have the following characteristics available to be used in the columns:
    Value type (10)
    version (currently I'm using variable for it)
    Currency type (020)
    Currency (USD).
    Can you explain what my restricted key figure should be based on and how it should look.
    I tried to create a restircted key figure using 0AMOUNT, and 0FISCPER3. For 0FISCPER3  I created a range from 1 to previous period (using SAP EXIT that supplied previous period).I also had value type, version, currency type, and currency included in that restricted key figure.Then when I tried to drag 0FISCPER3 under the restricted key figure once again, it wouldn't let me, probably because I've already used 0FISCPER3 in the restricted key figure.
    Please let me know if my explanation is not clear.
    Your step by step help would be great.
    Thanks
    Edited by: Ehab Mansour on Sep 23, 2008 2:40 PM

  • Report Column as link or normal text based on SQL result

    Hi all,
    I would like to achieve the following:
    I have a report based on a PL/SQL function returning SQL query.
    The first column contains an ID (i.e. a number)
    If this number is contained in a nother table.field this column in this row shall be a link to another page incl. item assignments.
    If this is not the case, it shall be displayed as normal text.
    Example:
    TABLE1.ID = 123456
    IF SELECT count(*) FROM TABLE2 WHERE ID = TABLE1.ID > 1 then
    show column as link
    ELSE
    show column as text
    ENDIF.
    Does anyone have a solution for this?
    Thanks and best regards.
    KMC

    Hi,
    You could achieve that by creating the HTML tags required in the SQL statement itself:
    SELECT ...
    CASE WHEN .... THEN '&lt;a href="f?p=....."&gt;'|| FIELDNAME || '&lt;/a&gt;' ELSE FIELDNAME END FIELDNAME,
    FROM ...Of course, this would mean that the column shouldn't be sortable by the user
    Andy

  • Change System Status of SO item dynamically based on Reason for Rejection

    Hi ppl,
    Our SAP user has raised a requirement as described below:
    In sales order (in creation mode (VA01) or change mode (VA02)), if at the item level, the reason for rejection is mentioned, then the system status for that item should be automatically set to Technically Complete SET (TECO); and if the user removes the reason for rejection for the item, then the system status Technically Complete should be RESET automatically.
    We are looking for any user-exit or BADI available which would be allow this dynamic change of system status based on the reason for rejection field. (No manual interaction for setting or resetting the system status).
    Technically, the functionality is based on the below fields:
    Reason for Rejection: VBAP-ABGRU
    System Status: JEST-STAT
    Please provide suitable inputs.
    Thanks,
    Dawood
    Edited by: Dawood.S.Ghasletwala on Jun 29, 2009 3:14 PM

    program: SAPMV45A
    User exit: USEREXIT_SAVE_DOCUMENT_PREPARE.
    loop at xvbap where updkz NE 'D'.
      if not xvbap-abgru is initital.
        "set your system state here.
      else.
       "reset your system state here.
      endif.
    endloop.
    hmmm you can as well try if you got all you need to know already in userexit: USEREXIT_CHECK_VBAP.
    Edited by: Florian Kemmer on Jun 29, 2009 11:53 AM

  • Creating support desk ticket based on the result in TCode : STWB_WORK

    Hi All,
    I am now under the process of TEST Management.
    I had done creating and assigning Test Packages to the tester.
    When tester tries to test their respective package in STWB_WORK, the result will be success or failure (with errors or warnings)
    Now I want to create a support desk message automatically when the result is not success.
    I had developed program for creating support message but I am unaware of where to incorporate the program and how to retrieve the values of the error message.
    Earlier I planned to have workflow so that when the user executes the test, we can automatically perform support desk message creation.
    But the error message is initially shown in the ECC Server and then only updated in SOLMAN.
    Please help me to create support ticket automatically.
    Thanks in advance
    Saman

    Hi,
    please check function module STAT_OBJECT_EDIT_TW.
    It is called when a test case is edited.
    You can enhance it at the end. There you have the old status value and the new status value. If the new status value is an error status and not the same as the old status, you can create a support message with your program.
    Regards,
    Christoph

  • Need to create link items dynamically

    Hi,
    I need a help from you guys regarding the creation of dynamic link items.
    Version: 9i.
    Technology: OAF.
    Regards,
    tamil.

    Tamil,
    The "you guys" you need to ask can be found [url http://forums.oracle.com/forums/forum.jspa?forumID=210]here
    John

  • Creating Files Dynamically based on Condition

    Hi Experts,
    I want to create a scenario in which I want to have N number of target files based on some condition.
    Suppose I have following Source structure .
    <ns0:MT_Employee_Src xmlns:ns0="urn://FileToFile_ERD">
       <Details>
          <EmpId>1</EmpId>
          <Name>Rabi</Name>
          <Designation>ABAP</Designation>
       </Details>
          <EmpId>4</EmpId>
          <Name>Satya</Name>
          <Designation>ABAP</Designation>
       </Details>
    </ns0:MT_Employee_Src>
    My requirement is I want to have 2 different target files based on EmpId.
    And this should be dynamic that means N number of EmpId in my source will create N number of files.
    Can anyone help me to solve this?
    Any kind of suggestion will be appreciated.
    Thanks
    Rabi

    Hi All,
    As my requirement was to create N files dynamically based on some condition so I first used 1:N multimapping without BPM.
    Then I followed RP's steps.
    Follow those steps
    1) in the message Mapping go to Signature T..Outbounded.
    2)later go back to main tab . you shoud create a mapping like this:
    3)<EmpId>--> change the context to MT_Employee_Src. to do that press right button on the field and go to context menu option.
    map this field to the proper header target structure E.X: MT_Employee_Tgt
    4) doing this you will create as many target files as <EmpId> you receive.
    5) map the rest of the fields
    This is great.And  this helped me a lot and finally gave solution.
    I want to share one thing that I faced.
    when you are doing 1:N multi-mapping then you have to change the occurrence of target .
    Then your source and target structure will be changed .If you are taking the source schema from mapping then remove the extra tags those got generated due to multi mapping such as
    <ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">
    - <ns0:Message1>
    </ns0:Message1>
      </ns0:Messages>
    And then use the file and it will work fine.
    Thanks
    Rabi

  • Delete regions items buttons and pages using sql.

    Hi,
    Is there any way to delete from apex pages, regions, items and buttons using sql.
    I noted that in SQL Developer a display of these objects is enabled, but no actions can be carried out on them from what I can see.
    Ben

    Hi and welcome,
    do search in the [Java Database Connectivity (JDBC) forum|http://forum.java.sun.com/forum.jspa?forumID=48], I'm sure you'll find a few examples there.

  • Can we create items dynamically or at run time?

    Hello expert,
    can we create some item dynamically at some button click?
    Thanks
    yash

    yash_08031983 wrote:
    Hello expert,
    can we create some item dynamically at some button click?Hello, yash
    You can not create items at run time. But you can manage them at run time by setting Visible property programatically.
    Hope this helps..
    Hamid

  • Using Create table command in a Pl/Sql Anonymous Block

    Hi,
    I need to create a table dynamically based on the table_name and column_names that a user wants. When I use a Pl/sql Anonymous block to do this, it complains. Any suggestions ?
    Thanks,
    Marisa

    Personally this sounds like a bad design to me. I would say under most "normal" circumstances, you should not be creating tables on the fly. Especially one where a user has control over what columns,datatypes to use. Let a developer or dba take care of that.

  • Create a view dynamically

    I would like to create a view dynamically based on “Employee” table
    A view in each database should contain every column in “Employee” table except column called “year”. “Employee” table exists in every database but has different columns except “year” column ,so
    the employee view should contain different columns based on which database you create a view
    How can I create a view dynamically for each database? I am using SQL server 2008 R2

    Try this... (Note the @Debug parameter is there to allow you to preview the code before you create the view... 1 to view the dynamically generated code, 0 tt simply execute it.)
    DECLARE
    @DeBug BIT = 1,
    @ColumnString VARCHAR(MAX),
    @sql VARCHAR(MAX)
    SELECT
    @ColumnString = COALESCE(@ColumnString + ',' + CHAR(10) + CHAR(9), '') + c.COLUMN_NAME
    FROM
    INFORMATION_SCHEMA.COLUMNS c
    JOIN INFORMATION_SCHEMA.TABLES t ON c.TABLE_NAME = t.TABLE_NAME AND c.TABLE_SCHEMA = t.TABLE_SCHEMA
    WHERE 1 = 1
    AND t.TABLE_TYPE = 'BASE TABLE'
    AND c.TABLE_NAME = 'Employee'
    AND c.COLUMN_NAME <> 'Year'
    ORDER BY
    c.ORDINAL_POSITION
    SET @sql = '
    CREATE VIEW dbo.v_Employee
    AS
    SELECT
    ' + @ColumnString + '
    FROM dbo.Employee'
    IF @DeBug = 1
    BEGIN
    PRINT (@sql)
    END
    ELSE
    BEGIN
    EXEC (@SQL)
    END
    HTH,
    Jason
    Jason Long

Maybe you are looking for

  • Repeat run depreciation in AFAB

    Important and urgent The issue is related to depreciation, I have changed the depreciation key in the asset class and depreciation was posted this resulted in very high value of depreciation for the period. As standard SAP I understand that  when we

  • How can I get rid of a small "download" pop up?

    whatever I do online on my computer is always a small "download" popup in my way. How can I get rid of it? I have no idea where it comes from.

  • Keyboard "Delete" Key

    Hi eveyone, how are all of you? I have a little problem. I am using Keyboard event to call a function i-e, when user press the Delete key, the selected object will be deleted. Now the problem is that when I press only Delete key, nothing happens but

  • Whenever I plug my iPod in, it causes my computer to crash!

    Can anyway help me? I have an 80GB Classic Please!!!!!!!!!!!!!

  • DAQ Record and Playback

    I have a PCI-6534 DAQ card in a PC and I am trying to record and then playback some motor encoder signals. I used DAQAssistant to create the code and then I have tried to modularize it a bit. I'm guessing I broke something, but I am not sure what. My