LegendItem dynamic insertion

Hello,
I'm writting and application that repopulates a legend quite frequently. I've written some code in Flex 3.0 to accomplish this. Here is the main function that does the work:
    signalLegend.removeAllChildren();
    for (var i:int = 0; i < numItems - 1; i++) {
        intensity = Math.floor(count * 256.0 / maxValue);
        if (count > 0) {
            // Yellow (neutral) to red
            paintColor = getHexFromRGB(255, 255 - intensity, 0);
        } else {
            // Yellow to blue
            paintColor = getHexFromRGB(255 + intensity, 255 + intensity, - intensity);
        signalLegend.addChild(new LegendItem());
        legendItem = signalLegend.getChildAt(i) as LegendItem;
        legendItem.label = String(roundNumber(count, 2));
        legendItem.setStyle("fill", paintColor);
        count -= perItem;
It basically dynamically adds a LegendItem to a Legend component. The issue however is that as I add the items they render in a horizontal direction as opposed to to vertical (which is how I have it originally set). Take a look:
mx:Legend left=0 bottom=270 id=signalLegend color=#FFFFFF direction=vertical verticalGap=3
I'm wondering why the heck it's not aligning them properly and there really isn't much of any documentatin on this.
Thanks in advance,
Dave

Legend does have a direction property. Maybe that property is getting reset inadvertantly, such that you could set it to horizontal somewhere to eliminate the problem, though you would think it would be unnecessary.

Similar Messages

  • Dynamic insertion of MIME object into a web dynpro component

    Hi,
    I want to dynamically insert a MIME object of type JPEG or type GIF into my web dynpro component at runtime.
    I was unable to find the database table which contains the list of MIME objects for a particular web dynpro component.
    Can you please help me out with this?
    Thanks in advance,
    Adithya
    Moderator message: wrong forum, please have a look in the "Web Dynpro ABAP" forum.
    Edited by: Thomas Zloch on May 23, 2011 9:55 AM

    Hi Muzammil Bichoo ,
                                   when you copy the wda component, it will be copied and will be in active state, once all the components are activated means, windows, views, everything will be available.
    now create application for your component, if you have more than one window(interface view) select the one which you need for the application.
    Regards
    Sarath

  • Dynamic insertion of elements based on dynamic condition

    I need to achieve the following:
    Input:
    <Customer>
         <name>Name1</name>
         <email>Email1</email>
         <phone>Phone1</phone>
         <Number>Num1</Number>
    <Customer>     
    Output:
    <Customer>
         <name>Name1</name>
         <email>Email1</email>
         <phone>Phone1</phone>
         <Number>Num1</Number>
         <Addresses>
              <Address>add1</Address>
              <Address>add1</Address>
              <Address>add1</Address>
         </Addresses>
    <Customer>
    Based on the number of Addresses that exist for the customer, multiple <Address> elements should be added.
    I can't determine number of Addresses at the beginning. It is deterrmined dynamically based on certain condition.
    So each time when the condition is met, I need to get the count of <Address> elements that exist and insert the new one last.
    My logic:
         Switch (case)     ==> Add <Address> only if condition is met
              count ==> count(bpws:getVariableData('outputVariable','payload','/ns1:Customer/ns1:Addresses')) ==> 0 first time
              <Addresses>
                   <Address>add1</Address> ===> Now I need to insert this.
              </Addresses>
    I have the following in my bpel:
    <assign name="AssignInsertAfterExisting">
    <copy>
    <from expression="count(bpws:getVariableData('outputVariable','payload','/ns1:Customer/ns1:Addresses'))"/>
    <to variable="NumberOfAds"/>
    </copy>
    <copy>
    <from expression="'123 street'"/>
    <to variable="nextAddress"/>
    </copy>
    <bpelx:insertAfter>
    <bpelx:from variable="nextAddress"/>
    <bpelx:to variable="outputVariable" part="payload"
    query="/ns1:Customer/ns1:Addresses/ns1:Address squareBrakets NumberOfAds squareBrakets"/>
    </bpelx:insertAfter>
    </assign>
    But with the above I am receiving the folllowing error:
         Assign Operation Misuse.
         The to-spec does not yield any data; insertAfter operation cannot be performed.
    Please check the BPEL source at line number ..
    I can I insert dynamically insert elements into array. I have seen the example provided in samples, but my problem is little different than that.
    Edited by: user10367892 on Aug 4, 2009 3:16 AM

    append is appending value of variable to existing element, instead of creating a new element in the array:
    For Eg:
    Input:
    <bpelx:append>
    <bpelx:from variable="nextAddress"/>
    <bpelx:to variable="outputVariable" part="payload" query="/ns1:Customer/ns1:Addresses/ns1:Address"/>
    </bpelx:append>
    Output if nextAddress = Address2 and if <Address>Address1</Address> already exists
    <Customer>
         <Addresses>
              <Address>Address1Address2</Address>
         </Addresses>
    </Customer>

  • Dynamicly insert rows in a table

    I wanna know if it is possible to dynamicly insert and delete rows into a table. So I want to have a table with a column with only "add-buttons" and a column with only "delete-buttons". If you click on an add, after that row an extra row would be inserted. If you click on a delete-button, the row would be deleted.

    Yes, this is called a client-side dynamic PDF form. Have a look at the dynamic interactive Purchase Order sample in C:\Program Files\Adobe\Designer 7.1\EN\Samples\Purchase Order\Dynamic Interactive\Forms

  • FLEX-NO DYNAMIC INSERTS:

    Friends,
    While executing the create_sit api with 4 segments this error is coming
    'FLEX-NO DYNAMIC INSERTS:' Allow Dynamic Insert Checkbox also checked only... any clarifications?
    Hr_Sit_Api.create_sit ( p_validate => FALSE
    ,p_person_id => v_person_id
    ,p_business_group_id => 82
    ,p_id_flex_num => v_id_flex_num
    ,p_effective_date => TRUNC(SYSDATE)
    ,p_date_from => TRUNC(SYSDATE)
    ,p_segment1 => P_CASH_ADVANCE
    ,p_segment2     => P_SALARY_ADVANCE
              ,p_segment3     => P_CASH_IMPREST
              ,p_segment4     => P_TOTAL_AMOUNT
    ,p_analysis_criteria_id => v_analysis_criteria_id
    ,p_person_analysis_id => v_person_analysis_id
    ,p_pea_object_version_number => p_pea_object_version_number
    Regards
    Mano

    Post in e-Business Suite Forum
    http://forums.oracle.com/forums/category.jspa?categoryID=3

  • How to dynamically insert UI to View

    i need dynamically create link,
    like HTML Tag <a href='URL' >text</a>
    public void wdDoInit()
    ArrayList al = .... (URL String List)
    for(int i =0;i<al.size(); i++)
    ..... HOW  TO CODING??
    Dynamically Insert UI to View or Dynamically Insert UI to View LinkToURL

    hi  Sarbjeet
    this is my code,
    how coding LinkToURL UI put in Group UI and how use group.createLayout() method for GridLayout ?
         if(firstTime)
              IWDTransparentContainer tc = (IWDTransparentContainer)view.getElement("RootUIElementContainer");
              tc = (IWDTransparentContainer)view.getElement("RootUIElementContainer");
              IWDCaption groupTitle = (IWDCaption)view.createElement(IWDCaption.class,"GroupTitle");
              groupTitle.setText("TempGroup");
              IWDGroup group = (IWDGroup)view.createElement(IWDGroup.class,"DynamicallyGroup");
              group.setHeader(groupTitle);
              group.setWidth("100%");
              group.setEnabled(true);
              tc.addChild(group);
              for (int i=0 ; i<10; i++)
                   tc = (IWDTransparentContainer)view.getElement("RootUIElementContainer");
                   IWDLinkToURL ld = (IWDLinkToURL)view.createElement(IWDLinkToURL.class,"ltu"+i );
                   ld.setTarget("http://www.google.com");
                   ld.setReference("http://www.google.com");
                   ld.setText("test..."+i+"\t");
                   ld.setEnabled(true);
                   tc.addChild(ld);

  • Is it possible to enable DOM events from a dynamically inserted QuickTime?

    QuickTime in IE uses an <object> as a 'behaviour' template in order to enable DOM events. The behaviour <object> is referenced from the QuickTime plugin instance with IE's behavior style: style="behavior: url(#idof_behaviorobject)".
    This works great for all QuickTime <object> instances declared before window.onload, but QuickTime <object> instances inserted into the DOM after that do not pick up the DOM events behaviour.
    I do not know exactly how behaviour styles work and what I've read so far hasn't made me any the wiser. Are behaviours called on elements that reference them, only on page load, and therefore can't be picked up later?
    Are there any known workarounds for enabling DOM events from QuickTime objects inserted after page load?
    Just so you know - I've tried various methods of DOM insertion - innerHTML, createElement, and calling iframes with their own html page containing the necessary objects. None of these work for enabling DOM events on insertion after page load.
    ( P.S. I've cross-posted this question on stackoverflow here:
    http://stackoverflow.com/questions/1336678/is-it-possible-to-enable-dom-events-f rom-a-dynamically-inserted-quicktime-object
    If I get a working answer I'll copy it across. )
    Cheers!
    Stephen.

    I found forwarding the impl_processMouseEvent kind of works ... except when the graphics of the transparent child window floats over the owner window's chrome elements - in particular the title bar, minimise/maximise and resized borders won't accept forwarded mouse events this way.
    Not true mouse transparency.

  • Dynamic INSERT from associative array

    Ok, this would be an one-liner in python or perl, but as a newbie in PL/SQL, it feels like swimming in molasses. So before going on and reinvent the wheel, is there any builtin or sample code that generates dynamically an insert statement from a hashtable ? That is, given a table:
    hashtable = {
    'name' : 'Michael',
    'age' : 23,
    'income' : 67213.34
    and a table_name ('Employee'), generate the query
    INSERT INTO Employee (name,age,income) VALUES ('Michael', 23, 67213.34);
    Thanks,
    George

    user603743 wrote:
    @sb92075
    Well, we have been in product development for past dozen years. In my humble opinion, we know a thing are two about product design. But thanks for your inputs though.
    Obviously you are not doing so well with this "design"... Just sayin'... :) :)
    You seems to be expert in the application/product design. Have you ever heard of "user data mashup" concept in data warehousing? Just curious.
    "user mashup" would indicate that the user actually controls how this is done. You, as a "product" will be making some [potentially very bad] assumptions about the end-user data that cannot be accounted for in a "canned" product. You can influence how it is done, but, in the end, does it meet the exact business needs of the end-user.
    you could possibly use some PL/SQL packages to
    1) get all of the tables
    2) get all of the columns.
    3) do the mashup.
    Now a question. Let's say table1 and table3 have (col1 + col2) that are the same and column3 is different. What do you put in column3?? or is this another row.
    Edited by: user603743 on May 29, 2013 4:52 PM

  • Dynamic insertion of data in a Dynamic Column in a table

    Hi EveryBody ,
    I have a table where i am increasing the column dynamically . I need to insert data through PreparedStatement Like
    pst = con.prepareStatement(CBBsqlConstants.addOrderItem);
                   pst.setString(1,ein);
                   pst.setString(2,insert_date);
                   pst.setString(3,checkList);
                   pst.setString(4,Quantities);
                   pst.setDate(5,pick_date);
                   pst.setDate(6,completed_date);
                   pst.setString(7,comment);
                   pst.setInt(8,status);
                   pst.setString(9,agent_ein);
                   i = pst.executeUpdate();
    But here my column is increasing dynamically, so the above cant be constant as column is incresing . how do i handle the insertion part dynamically.
    Thanks So much . Please help with this .

    Server_java wrote:
    Ya you are right ,
    Take i am ordering some Items and quantity from checkbox and inserting that to the table , each item and quantity is going to consume a row , but when i am going have column for each item , all the items i am going to select is going to appear in a single row . so i am consuming .But only 256 column is allowed for a table ,but my item is not going to excced that . That maximum number of columns is the least of the problems here.
    The problem is that you are taking data that should be in another table and turning it into metadata instead. That's a mistake because it makes your entire application brittle and it doesn't need to be. It also will make querying your table a nightmare.
    Let's take a look at your solution and then the correct solution.
    Your solution (condensed)
    tblOrder
    id
    customername
    apples
    oranges
    bananas
    cherries
    Sample data (CSV format for the forum)
    1,"John Smith",0,0,0,1
    2,"Jane Smith",1,0,0,3
    3,"Kate Smith",0,2,1,0
    The correct solution
    tblOrder
    id
    customername
    Sample data
    1,"John Smith"
    2,"Jane Smith"
    3,"Kate Smith"
    tblProduct
    id
    name
    Sample data
    1, "Apples"
    2,"Oranges"
    3, "Bananas"
    4, "Cherries"
    tblOrderItem
    orderid
    productid
    quantity
    Sample data
    1,4,1
    2,1,1
    2,4,3
    3,2,2
    3,3,1
    So what's the difference?
    With your design what happens when you want to add a new fruit? Your schema changes and all your code breaks. With my design you simply insert one row and that's it.
    And what happens if you do happen to eventually need more than 250 odd fruits? With your design you are screwed. With my correct design it's never going to be a problem.
    And consider that with my design you can populate user inteface components using actual data and not table meta data.
    And the list goes on... the point is the only correct solution is to use a proper relational design.

  • Dynamic insert for Special Characters

    Hello,
    I'm running into a problem inserting data with Special Characters. I have a report (designed oracle reports), that takes data and inserts the data into table. I use the SRW.do_sql built in package in a before report trigger to process the data. However the problem that I'm running into is how to dynamically account for the special characters in a description field that I have. There is no way for me to predict where or how many can appear in a field. For example, I may have a field that contains data like:
    O'REILLY AND ASSOCIATES INC.
    OR
    FULLER & D'ALBERT, INC.
    OR
    JOANNE'S BED & BACK SHOP
    The only special characters that seem to be used and are causing me problems are the " ' " and " & ".
    Does anyone know how I can dynamically account for these special characters in my insert statement?
    Thanks,
    Martin

    Hello,
    I'm using SRW.DO_SQL procedure in oracle reports because that is one you can run text via reports. The report actually exports the results to a text file and insert the results into a table. Anyway, the SRW.DO_SQL isn't my problem but rather the special characters. I have researched the problem some more and I have found a solution. You can use the "replace" feature to do an insert/update of special characters. You also need to find the character number for each special character. I believe "&" is chr(38), "%" is chr(37), "#" is chr(35), "@" is chr(64), "'" is char(39). So the code would be:
    insert into tableA (column1) values(
    replace(replace(replace(replace(replace(v_entity_name,chr(39),chr(39)),chr(38),chr(38)),chr(35),chr(35)),chr(37),chr(37)),chr(64),chr(64));
    Martin

  • Dynamic insert statement

    Hi all
    I had problem in insert statement.
    I know the column of the table, tablename and the value to be insert.
    My code:
    Data: column(20) type c.   -
    >refer to the tablecolumn
    Data: tablename(20) type c.  -
    >refer to table name
    Data: value(20) type c.          -
    >value to be insert to the column in the table
    column = 'Admino'.
    tablename = 'Student'.
    value = '123456'.
    <b>insert <column> into <tablename> values <value>.</b>
    i know there something wrong with my insert statement. How to do it in abap insert code where i can put in all the parameter in the insert statement.
    Anycode or sample to show. Many thank.

    From f1 help....
    EXTRACT
    Basic form
    EXTRACT fg.
    Effect
    Writes all fields of the field group fg (FIELD-GROUPS) as an entry in asequential dataset. If you have defined a field group HEADER,its fields precede each entry as a sort key. Afterwards, you canuse SORT and LOOP ... ENDLOOP to sort or process the datasetrespectively. No further EXTRACT statements are possible afterthis.
    Notes
    General:
    As soon as you have extracted a dataset using EXTRACT, you canno longer extend the field group using INSERT. In particular, you cannot change the HEADERfield group at all after the first EXTRACT (regardless of thefield group to which it applied).
    Large extract datasets are not stored in main memory. Instead, theyare kept in an external auxiliary file. You can set the directory inwhich this file is created using the SAP profile parameterDIR_EXTRACT. The default directory is the SAP data directory(SAP profile parameter DIR_DATA).
    Notes
    Runtime errors:
    EXTRACT_AFTER_SORT/LOOP: EXTRACT after SORT, orLOOP. EXTRACT_BUFFER_NO_ROLL: Unable to create the required main
    EXTRACT_FIELD_TOO_LARGE: Occupied length of a field is toolarge.
    EXTRACT_HEADER_NOT_UNIQUE: Field group HEADER wasmodified after an EXTRACT statement.
    EXTRACT_OPEN_EXTRACTFILE_OPEN:
    Error opening the external extract dataset file.
    EXTRACT_RESOURCEHANDLER_FAILED: Error deleting the externalextract dataset file.
    EXTRACT_TOO_LARGE: Total length of the entry for extraction(including HEADER fields) is too large.
    Additional help
    Filling anExtract with Data
    Extracts
    Since internal tables have fixed line structures, they are not suited to handle data sets with varying structures. Instead, you can use extract datasets for this purpose.
    An extract is a sequential dataset in the memory area of the program. You can only address the entries in the dataset within a special loop. The index or key access permitted with internal tables is not allowed. You may only create one extract in any ABAP program. The size of an extract dataset is, in principle, unlimited. Extracts larger than 500KB are stored in operating system files. The practical size of an extract is up to 2GB, as long as there is enough space in the filesystem.
    An extract dataset consists of a sequence of records of a pre-defined structure. However, the structure need not be identical for all records. In one extract dataset, you can store records of different length and structure one after the other. You need not create an individual dataset for each different structure you want to store. This fact reduces the maintenance effort considerably.
    In contrast to internal tables, the system partly compresses extract datasets when storing them. This reduces the storage space required. In addition, you need not specify the structure of an extract dataset at the beginning of the program, but you can determine it dynamically during the flow of the program.
    You can use control level processing with extracts just as you can with internal tables. The internal administration for extract datasets is optimized so that it is quicker to use an extract for control level processing than an internal table.
    Procedure for creating an extract:
    Define the record types that you want to use in your extract by declaring them as field groups. The structure is defined by including fields in each field group.
    Defining an Extract
    Fill the extract line by line by extracting the required data.
    Filling an Extract with Data
    Once you have filled the extract, you can sort it and process it in a loop. At this stage, you can no longer change the contents of the extract.
    Processing Extracts
    INSERT Statement
    The INSERT statement is used to insert values into a single database table.
    <insert statement> ::= INSERT INTO <table name> <insert column list> <insert source>.
    <insert source> ::= VALUES '(' <value> ( ',' <value> )* ')'
    | <query specification>.
    <value> ::= <value expression>
    | <dynamic parameter specification>
    | NULL.
    <insert column list> ::= '(' <column name> ( ',' <column name> )* ')'.
    In Open SQL the <insert column list> is not optional.
    You cannot specify string literals as values for CLOB columns. Hex literals are not supported in Open SQL.
    Examples
    INSERT INTO employees (employee_id, employee_name)
    VALUES (4711, 'John Smith')
    Inserting Values. A new row is inserted into the table employees with the values 4711 and 'John Smith' for the columns employee_id and employee_name respectively.
    INSERT INTO well_paid_employees (employee_id, salary)
    SELECT employee_id, salary
    FROM employees
    WHERE salary > ?
    Inserting the Result of a Query. The employee_idand the salaryof all employees from table employeeswith a salary exceeding a certain value are inserted into the table well_paid_employees.
    Please reward points if helpful.

  • Dynamically inserting in an internal table with expansion & collapse.

    I have an Internal table wherein I have implemented Expansion and collapse. Now I want to sort this table dynamically everytime a new Child node is added to a Father Node. How do I sort it so that the Child nodes are inserted correctly under their corresponding Father Nodes?
    I tried using Indexing concept , e.g., insert <structure> into <itab> index lv_ind.
    lv_ind = sy-tabix + lines( itab ).
    For the First Father Node, the Child nodes are inserted in the correct position but when the Second Father Node is reached( say in position 12 ), then lv_ind gets a wrong value... The Child node should now be inserted in the 13th position but its inserted in lv_ind = sy-tabix + lines( itab ) = 12 + 12 = 24th position.
    Please let me know how to go about.
    Thanks and regards,
    Sukanya.

    Why can u sort the internal table once insertions are completed.
    SortITAB by Fathernode Childnode.

  • BULK COLLECT and FORALL with dynamic INSERT.

    Hello,
    I want to apply BULK COLLECT and FORALL feature for a insert statement in my procedure for performance improvements as it has to insert a huge amount of data.
    But the problem is that the insert statement gets generated dynamically and even the table name is found at the run-time ... so i am not able to apply the performance tuning concepts.
    See below the code
    PROCEDURE STP_MES_INSERT_GLOBAL_TO_MAIN
      (P_IN_SRC_TABLE_NAME                  VARCHAR2 ,
      P_IN_TRG_TABLE_NAME                  VARCHAR2 ,
      P_IN_ED_TRIG_ALARM_ID                 NUMBER ,
      P_IN_ED_CATG_ID                 NUMBER ,
      P_IN_IS_PIECEID_ALARM IN CHAR,
      P_IN_IS_LAST_RECORD IN CHAR
    IS
          V_START_DATA_ID                 NUMBER;
          V_STOP_DATA_ID                   NUMBER;
          V_FROM_DATA_ID                   NUMBER;
          V_TO_DATA_ID                       NUMBER;
          V_MAX_REC_IN_LOOP              NUMBER := 30000;
          V_QRY1         VARCHAR2(32767);
    BEGIN
                EXECUTE IMMEDIATE 'SELECT MIN(ED_DATA_ID), MAX(ED_DATA_ID) FROM '|| P_IN_SRC_TABLE_NAME INTO V_START_DATA_ID , V_STOP_DATA_ID;
                --DBMS_OUTPUT.PUT_LINE('ORIGINAL START ID := '||V_START_DATA_ID ||' ORIGINAL  STOP ID := ' || V_STOP_DATA_ID);
                V_FROM_DATA_ID := V_START_DATA_ID ;
                IF (V_STOP_DATA_ID - V_START_DATA_ID ) > V_MAX_REC_IN_LOOP THEN
                        V_TO_DATA_ID := V_START_DATA_ID + V_MAX_REC_IN_LOOP;
                ELSE
                       V_TO_DATA_ID := V_STOP_DATA_ID;
                END IF;
              LOOP
                    BEGIN
                 LOOP      
                            V_QRY1 := ' INSERT INTO '||P_IN_TRG_TABLE_NAME||
                            ' SELECT * FROM '||P_IN_SRC_TABLE_NAME ||
                            ' WHERE ED_DATA_ID BETWEEN ' || V_FROM_DATA_ID ||' AND ' || V_TO_DATA_ID;
                    EXECUTE IMMEDIATE V_QRY1;
    commit;
                                     V_FROM_DATA_ID :=  V_TO_DATA_ID + 1;
                            IF  ( V_STOP_DATA_ID - V_TO_DATA_ID > V_MAX_REC_IN_LOOP ) THEN
                                  V_TO_DATA_ID := V_TO_DATA_ID + V_MAX_REC_IN_LOOP;
                            ELSE
                                  V_TO_DATA_ID := V_TO_DATA_ID + (V_STOP_DATA_ID - V_TO_DATA_ID);
                            END IF;
                    EXCEPTION
                             WHEN OTHERS THEN.............
    ....................so on Now you can observer here that P_IN_SRC_TABLE_NAME is the source table name which we get as a parameter at run-time. I have used 2 table in the insert statement P_IN_TRG_TABLE_NAME (in which i have to insert data) and P_IN_SRC_TABLE_NAME(from where i have to insert data)
      V_QRY1 := ' INSERT INTO '||P_IN_TRG_TABLE_NAME||
                            ' SELECT * FROM '||P_IN_SRC_TABLE_NAME ||
                            ' WHERE ED_DATA_ID BETWEEN ' || V_FROM_DATA_ID ||' AND ' || V_TO_DATA_ID;
                    EXECUTE IMMEDIATE V_QRY1;now when i appy the bulk collect and forall feature i am facing the out of scope problem....see the code below ...
    BEGIN
                EXECUTE IMMEDIATE 'SELECT MIN(ED_DATA_ID), MAX(ED_DATA_ID) FROM '|| P_IN_SRC_TABLE_NAME INTO V_START_DATA_ID , V_STOP_DATA_ID;
                --DBMS_OUTPUT.PUT_LINE('ORIGINAL START ID := '||V_START_DATA_ID ||' ORIGINAL  STOP ID := ' || V_STOP_DATA_ID);
                V_FROM_DATA_ID := V_START_DATA_ID ;
                IF (V_STOP_DATA_ID - V_START_DATA_ID ) > V_MAX_REC_IN_LOOP THEN
                        V_TO_DATA_ID := V_START_DATA_ID + V_MAX_REC_IN_LOOP;
                ELSE
                       V_TO_DATA_ID := V_STOP_DATA_ID;
                END IF;
              LOOP
                    DECLARE
                     TYPE TRG_TABLE_TYPE IS TABLE OF P_IN_SRC_TABLE_NAME%ROWTYPE;
                     V_TRG_TABLE_TYPE TRG_TABLE_TYPE;
                     CURSOR TRG_TAB_CUR IS
                     SELECT * FROM P_IN_SRC_TABLE_NAME
                     WHERE ED_DATA_ID BETWEEN V_FROM_DATA_ID AND V_TO_DATA_ID;
                     V_QRY1 varchar2(32767);
                    BEGIN
                    OPEN TRG_TAB_CUR;
                    LOOP
                    FETCH TRG_TAB_CUR BULK COLLECT INTO V_TRG_TABLE_TYPE LIMIT 30000;
                    FORALL I IN 1..V_TRG_TABLE_TYPE.COUNT
                    V_QRY1 := ' INSERT INTO '||P_IN_TRG_TABLE_NAME||' VALUES V_TRG_TABLE_TYPE(I);'
                    EXECUTE IMMEDIATE V_QRY1;
                    EXIT WHEN TRG_TAB_CUR%NOTFOUND;
                    END LOOP;
                    CLOSE TRG_TAB_CUR;
                            V_FROM_DATA_ID :=  V_TO_DATA_ID + 1;
                            IF  ( V_STOP_DATA_ID - V_TO_DATA_ID > V_MAX_REC_IN_LOOP ) THEN
                                  V_TO_DATA_ID := V_TO_DATA_ID + V_MAX_REC_IN_LOOP;
                            ELSE
                                  V_TO_DATA_ID := V_TO_DATA_ID + (V_STOP_DATA_ID - V_TO_DATA_ID);
                            END IF;
                    EXCEPTION
                             WHEN OTHERS THEN.........so on
    But the above code is not helping me ,  what i am doing wrong ??? how can i tune this dynamically generated statement to use bulk collect for better performace ......
    Thanks in Advance !!!!

    Hello,
    a table name cannot be bind as a parameter in SQL, this wont't compile:
    EXECUTE IMMEDIATE ' INSERT INTO :1 VALUES ......
    USING P_IN_TRG_TABLE_NAME ...but this should work:
    EXECUTE IMMEDIATE ' INSERT INTO ' || P_IN_TRG_TABLE_NAME || ' VALUES ......You cannot declare a type that is based on a table which name is in a variable.
    PL/SQL is stronly typed language, a type must be known at compile time, a code like this is not allowed:
    PROCEDURE xx( src_table_name varchar2 )
    DECLARE
       TYPE tab IS TABLE OF src_table_name%ROWTYPE;
      ...This can be done by creating one big dynamic SQL - see example below (tested on Oracle 10 XE - this is a slightly simplified version of your procedure):
    CREATE OR REPLACE
    PROCEDURE stp1(
      p_in_src_table_name                  VARCHAR2 ,
      p_in_trg_table_name                  VARCHAR2 ,
      v_from_data_id     NUMBER := 100,
      v_to_data_id       NUMBER := 100000
    IS
    BEGIN
      EXECUTE IMMEDIATE q'{
      DECLARE
         TYPE trg_table_type IS TABLE OF }' || p_in_src_table_name || q'{%ROWTYPE;
         V_TRG_TABLE_TYPE TRG_TABLE_TYPE;
         CURSOR TRG_TAB_CUR IS
         SELECT * FROM }' || p_in_src_table_name ||
         q'{ WHERE ED_DATA_ID BETWEEN :V_FROM_DATA_ID AND :V_TO_DATA_ID;
      BEGIN
          OPEN TRG_TAB_CUR;
          LOOP
                FETCH TRG_TAB_CUR BULK COLLECT INTO V_TRG_TABLE_TYPE LIMIT 30000;
                FORALL I IN 1 .. V_TRG_TABLE_TYPE.COUNT
                INSERT INTO }' || p_in_trg_table_name || q'{ VALUES V_TRG_TABLE_TYPE( I );
                EXIT WHEN TRG_TAB_CUR%NOTFOUND;
          END LOOP;
          CLOSE TRG_TAB_CUR;
      END; }'
      USING v_from_data_id, v_to_data_id;
      COMMIT;
    END;But this probably won't give any performace improvements. Bulk collect and forall can give performance improvements when there is a DML operation inside a loop,
    and this one single DML operates on only one record or relatively small number of records, and this DML is repeated many many times in the loop.
    I guess that your code is opposite to this - it contains insert statement that operates on many records (one single insert ~ 30000 records),
    and you are trying to replace it with bulk collect/forall - INSERT INTO ... SELECT FROM will almost alwayst be faster than bulk collect/forall.
    Look at simple test - below is a procedure that uses INSERT ... SELECT :
    CREATE OR REPLACE
    PROCEDURE stp(
      p_in_src_table_name                  VARCHAR2 ,
      p_in_trg_table_name                  VARCHAR2 ,
      v_from_data_id     NUMBER := 100,
      v_to_data_id       NUMBER := 100000
    IS
    V_QRY1 VARCHAR2(32767);
    BEGIN
          V_QRY1 := ' INSERT INTO '||   P_IN_TRG_TABLE_NAME ||
                    ' SELECT * FROM '|| P_IN_SRC_TABLE_NAME ||
                    ' WHERE ed_data_id BETWEEN :f AND :t ';
          EXECUTE IMMEDIATE V_QRY1
          USING V_FROM_DATA_ID, V_TO_DATA_ID;
          COMMIT;
    END;
    /and we can compare both procedures:
    SQL> CREATE TABLE test333
      2  AS SELECT level ed_data_id ,
      3            'XXX ' || LEVEL x,
      4            'YYY ' || 2 * LEVEL y
      5  FROM dual
      6  CONNECT BY LEVEL <= 1000000;
    Table created.
    SQL> CREATE TABLE test333_dst AS
      2  SELECT * FROM test333 WHERE 1 = 0;
    Table created.
    SQL> set timing on
    SQL> ed
    Wrote file afiedt.buf
      1  BEGIN
      2     FOR i IN 1 .. 100 LOOP
      3        stp1( 'test333', 'test333_dst', 1000, 31000 );
      4     END LOOP;
      5* END;
    SQL> /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:22.12
    SQL> ed
    Wrote file afiedt.buf
      1  BEGIN
      2     FOR i IN 1 .. 100 LOOP
      3        stp( 'test333', 'test333_dst', 1000, 31000 );
      4     END LOOP;
      5* END;
    SQL> /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:14.86without bulk collect ~ 15 sec.
    bulk collect version ~ 22 sec. .... 7 sec longer / 15 sec. = about 45% performance decrease.

  • Dynamically insert data into PDF possible?

    This is the scenario and I am hoping someone can advise whether it is possible.
    We want to create a PDF fillable form. However there are a few fields that we want to be read only but to injected before the user downloads the PDF.
    e.g.
    There is a PDF form called contact details. Only registered users can download this form. So what we are trying to achieve here is when the user logs on and downloads this PDF, server side we want to inject their details into this form so that it is read only.
    In the lifestyle IDE there is a XML tab where I can see it drives the PDF.
    Is there like a tool of some sort where I can dynamically update the XML source and regenerate the PDF?
    Thanks

    Thanks sandeep for your quick reply.
    My req is
    Step 1:- invoke a webservice call and get the data from a website and store it into a table in xml format(CLOB column in a table)
    Step 2 :- Pick the xml data from table inserted by step1 and derive all the element values from xml data usning some xml functions
    2.1 go to configuration table(in this table we are storing the table name for each type of webservice call) and get the destination table name.
    2.3 insert the data into destination table.
    so our interface process is designed to serve for multiple interface webservice calls.it is not for a particular data.
    so in future if someone else want to download some other data then they need to add the configuration data into config tables and should be able to achieve the data download into tables.
    so step 1 and step 2 should be a coomon packages.
    i am involved in 2nd package where pick the xml data and insert into a table(destination table form config tablke)
    Thanks Ram

  • Dynamically inserting new line in Internal table

    Hi,
      Can anyone help me how to insert a new line dynamically to the internal table.
    Assume there are 5 records that has been added to ITAB.
    In that if a particular field in that ITAB crosses the limit 10 then i have to split that line into two lines with the same data except that Par.field as 5 and the other record has 5.
    In the third record that particular field has value 10.
    Loop at ITAB.
       Once i found that field has 10 then how to insert a new line dynamically over here to add another record.
    endloop.

    Hi..
    Hi..
    try this..
    loop at itab.
    if  ( i found that field <f1> has 10 ).
        w_line2 = itab-f1+5(5).
        w_line3 = itab-f1.
    ***********First  line********   
        itab-f1 = itab-f1+0(5).
        modify itab index sy-tabix from itab transporting f1.
    ***********second  line********    Hi..
    try this..
    loop at itab.
    if  ( i found that field <f1> has 10 ).
        w_line2 = itab-f1+5(5).
        w_line3 = itab-f1.
    ***********First  line********   
        itab-f1 = itab-f1+0(5).
        modify itab index sy-tabix from itab transporting f1.
    ***********second  line********   
        itab-f1 = w_line2.
        insert itab INDEX SY-TABIX.
    **********third line**************
        itab-f1 = w_line3.
         insert itab INDEX SY-TABIX.
    endloop.  
        itab-f1 = w_line2.
        insert itab INDEX SY-TABIX.
    **********third line**************
        itab-f1 = w_line3.
         insert itab INDEX SY-TABIX.
    endloop.

Maybe you are looking for

  • Adobe Reader XI is extremely slow (10 mins) opening a large SharePoint library (3000 docs)

    How can I speed up the opening of a SharePoint library in Adobe Reader XI using the Open from Online Account feature.  This is an onsite, locally hosted SharePoint instance (not SharePoint Online).  The library is approximately 3000 files, almost all

  • GRN mismatch and invoice blocked for payment

    Hi Team, We have an issue with regards to Invoices not being allocated to the right GRN's.  This causes some invoices to be paid without approval, and other invoices that have been approved to be blocked for payment. According to standard SAP require

  • MBP (Early 2008) Airport failure

    Hi there! I have a Problem with my MBP's Airport: I can't seem to connect to any Wireless...! Resetting PRAM and NVRAM doesn't solve the Problem... I compared the Airport Advanced settings with another MBP and they are identical... Network Diagnostic

  • Photoshop CS4 and HP printer C410 all I can print is 2 inch squares,

    I can set the size to anything in photoshop but all it will print is a 2" square. Can anyone help? or heard of this problem before?

  • Samples don't work under Oracle 10g w JDeveloper 10g

    I have downloaded and attempted to use 3 different samples, and not a single one of them works properly without modification. These were all developed a couple of years ago, probably tested under earlier versions, but do not work under the most curre