How to crate a dynamic size array, collection

Hi,
Can someone point me to some tutorial on how to create a dynamic size array. Actually I have multiple cursors and on different tables and want to loop through each cursor and get some values from each cursor and put it in an array. But don't know how to create or initialize an array as I don't know the size. Is there any other way.
Here is what I am doing I have 6 cursors on different tables, I loop through each cursor and get some specific data that I need to place at one place after looping through all the cursors which then finally needs to be inserted in one table. But before the insert I need to validate each data so want to have all the data in some array or some other place for temporary storage from it's easier to do the validate and insert rather than while looping through the cursors as there may be duplicates which I am trying to remove.
As this procedure will be called multiple times so wanted to save the cursor data in temporary array before inserting in the final table. Looking for some faster and efficient way.
Any help is appreciated.
Thanks

guest0012 wrote:
All the 6 cursors are independent and no relation i.e. can have a join and have one sql as no relationship in tables.If there is no relation, then what are your code doing combining unrelated rows into the same GTT/array?
Now using GTT when I do an insert how do I make sure the same data doesnot already exists. i.e. GTT will only have one column. Then create a unique index or primary key for the GTT and use that to enforce uniqueness.
So everytime I iterate over a cursor I have to insert into GTT and then finally again have to iterate over GTT and then do an insert in the final table which maybe a performance issue Which is why using SQL will be faster and more scalable - and if PL/SQL code/logic can be used to glue these "no relationship" tables together, why can't that not be done in SQL?
that's why i was wondering if can use any kind of array or collection as it will be a collection of numbersAnd that will reside in expensive PGA memory. Which means a limit on the size of the collection/array you can safely create without impacting server performance, or even cause a server crash by exhausting all virtual memory and causing swap space to trash.
and finally will just iterate ovr array and use FOR ALL for insert but don't know what will be the size of the array as I only know after looping the cursors the total number of records to be stored. So wondering if how to do it through collection/array is there a way to intialize the array and keep populating it with the data with defining the size before hand.You cannot append the bulk collect of one cursor into the collection used for bulk collecting another cursor.
Collections are automatically sized to the number of rows fetched. If you want to manually size collection, the Extend() method needs to be used, where the method's argument specifies the number of cells/locations to add to the collection.
From what you describe about the issue you have - collections are not the correct choice. If you are going to put the different tables's data into the same collection, then you can also combine those tables's data using a single SQL projection (via a UNION for example).
And doing the data crunching side in SQL is always superior in scalability and performance, than doing it in PL/SQL.

Similar Messages

  • How can I create a variable size array?

    How can I create a variable size array?

    ok then how can i create a new vector object?If you don't know that, you need to go back to your text book and study some more. Or read the tutorial on the basics of Java: http://java.sun.com/docs/books/tutorial/java/index.html
    After reading that you can move on to: http://java.sun.com/docs/books/tutorial/collections/index.html
    Anyway, the answer to your question is, of course:
    Vector v = new Vector();(But you should probably use ArrayList instead of Vector.)

  • How to get the byte[] size dynamically from the StreamMessage object

    Hi all,
    Using JMS, I am receiving the FDF file as StreamMessage from the queue and attaching it to the PDF file which is present in the local system.
    For that, I have written the code as follows:
    {color:#0000ff} Message msg = jmsTemplate.receive();
    if(msg !=null && msg instanceof StreamMessage)
    StreamMessage message = (StreamMessage) msg;{color}
    {color:#ff6600}//hardcoded the byte array size value
    {color}{color:#0000ff} byte[] bytes = new byte[{color:#ff0000}856{color}];
    System.out.println("read msg="+message.readBytes(bytes));{color}
    {color:#0000ff}PdfReader pdfreader = new PdfReader("D:\\Managing_Workflows_No_Comment.pdf");
    PdfStamper stamp = new PdfStamper(pdfreader, new FileOutputStream("D:\\12345.pdf"));
    FdfReader fdfreader = new FdfReader(bytes);
    stamp.addComments(fdfreader);
    {color} {color:#0000ff} stamp.close();
    {color}{color:#000000}The above code is working fine except with the hardcoded of {color:#ff0000}byte array{color}{color:#ff0000} size value{color} which is given in {color:#ff0000}RED{color} in color.
    Can anybody know, {color:#000000}*how to get the byte[] size dynamically from the StreamMessage*{color} object ?
    Any help would be highly beneficial for me !!!!
    Thanks and Regards,
    Ganesh Kumar{color}

    When you create your stream message you could add an property to your message, something like streamSize that would contain the number of bytes in your stream message. Then you could get this property from the message before declaring your array.
    Tom

  • How to convert an array collection instance to a complex object for interaction with webservice

    Hi there,
    I have a stubborn problem that I am trying to work out the best way to solve the problem.  I am interacting with a WebService via HTTPService calling a method called find(String name) and this returns me a List of ComplexObjects that contain general string and int params and also lists of other Complex Objects.  Now using the code:
    ArrayCollection newOriginalResultsArray = new ArrayCollection(event.result as Array)
    flex converts my complex objects results to an arraycollection so that I can use it in datagrids etc.  Now up until this part is all good.  My problem is when getting a single instance from the results list, updating it by moving data around in a new datagrid for example - I want to interact with the webservice again to do an create/update.  This is where I am having problems - because these webservice methods require the complex object as a parameter - I am struggling to understand how I can convert the array collection instance back to my complex object without iterating over it and casting it back (maybe this is the only way - but I am hoping not).
    I am hoping that there is a simple solution that I am missing and that there is some smart cookie out there that could provide me with an answer - or at least somewhere to start looking. I guess if I have no other alternative - maybe I need to get the people who built the service to change it to accept an array - and let them do the conversion.
    Any help would be greatly appreciated.
    Bert

    Hi Bert,
    According to my knowledge you can use describeType(Object) method which will return an XML... That XML will contain Properties and values just iterate through the XML and create a new Object..   Probably u can use this method...
    public function getObject(reqObj:Object,obj:Object,instanceName:String,name:String=null,index:int=-1):Obj ect
                if(!reqObj)
                    reqObj = new Object();
                var classInfo:XML = describeType(obj);
                var className:String = instanceName;
                if(name!=null)
                    className=name+"."+className;
                if(index!=-1)
                    className=className+"["+index+"]";
                for each (var v:XML in classInfo..accessor)
                    var attributeName:String=v.@name;
                    var value:* = obj[attributeName]
                    var type:String = v.@type;
                    if(!value)
                        reqObj[className+"."+attributeName] = value; 
                    else if(type == "mx.collections::ArrayCollection")
                        for(var i:int=0;i<value.length;i++)
                            var temp:Object=value.getItemAt(i);
                            getReqObject(reqObj,temp,attributeName,className,i);
                    else if(type == "String" || type == "Number" || type == "int" || type == "Boolean")
                        reqObj[ className+"."+attributeName] = value; 
                    else if (type == "Object")
                        for (var p:String in value)
                            reqObj[ className+"."+attributeName+"."+p] = value[p];
                    else
                        getReqObject(reqObj,value,attributeName,className);
                return reqObj;
    Thanks,
    Pradeep

  • How to find and modify  item in a nested array collection?

    Hi,
    would anybody know how to find and modify item in a nested
    array collection:
    private var ac:ArrayCollection = new ArrayCollection([
    {id:1,name:"A",children:[{id:4,name:"AA",children:[{id:8,name:"AAA"}]},{id:5,name:"AB"}]} ,
    {id:2,name:"B",children:[{id:6,name:"BA"},{id:7,name:"BB"}]},
    {id:3,name:"C"}
    Let's say I've got object {id:8, name:"X"} , how could I find
    item in a collection with the correspoding id property, get handle
    on it and update the name property of that object?
    I'm trying to use this as a dataprovider for a tree populated
    via CF and remoting....
    Thanks a lot for help!

    Thanks a lot for your help!
    In the meantime I've come up with a recursive version of the
    code.
    This works and replaces the item on any level deep:
    private function findInAC(ac:ArrayCollection):void{
    var iMatchValue:uint=8;
    for(var i:uint=0; i<ac.length; i++){
    if(ac
    .id == iMatchValue){
    ac.name = "NEW NAME";
    break;
    if(ac
    .children !=undefined){
    findInAC( new ArrayCollection(ac.children));
    However, if I use the array collection as a dataprovider for
    a tree and change it, the tree doesn't update, unless I collapse
    and reopen it.
    Any ideas how to fix it ?

  • How to auto insert a number array with size of 20 into a named excel file with the positon is from A1 TO A20?i use lv6.1

    can you give me a example vi for it ?thanks a lot!
    how to auto insert a number array with size of 20 into a named excel file  with the positon is from A1 TO A20?i use lv6.1

    You don't need us to give you an example, as the example already comes with LV. Go to Help>>Find Examples and search for "excel". You will find an example called "write table to XL". You should note that the example doesn't do that exactly, because it writes a 2D array from 2 to N.
    You can modify the example by using only one for loop (instead of nested loops) with a 1D array or by going into the Set Cell Value and modifying it to accept a second cell value for the Cell2 terminal and wiring in a 1D array instead of the single string. If you do modify it, be sure to save it under a different name, so you don't overwrite the original.
    To learn more about LabVIEW, I suggest you try searching this site and google for LabVIEW tutorials. Here and here are a couple you can start with. You can also contact your local NI office and join one of their courses.
    In addition, I suggest you read the LabVIEW style guide and the LabVIEW user manual (Help>>Search the LabVIEW Bookshelf).
    Try to take over the world!

  • How to make an auto size form of dynamic controls

    Hi Experts,
    i am creating a number of TextField controls and adding in the form component at run time.
    i set the width and height 100% but i need to have auto size form depending on the fields.
    please guide how can i set form size auto?

    As long as the form is inside a container that supports auto layout, lie VBox, and the VBox and Form have width and height set to 100% you should be okay.
    What is some simplified yet complete sample code and what problem are you actually experiencing?
    If this post answers your question or helps, please mark it as such.

  • How to create a spidar chart (Radar chart) with an array collection object...

    Hi All,
              I need to create Spidar (Radar) chart in my application with the help of an array collection object........can any one help me ?? do i need to import any external library ???
    Please provide the required code for it .........
    Thanks in advance....

    You'll need to set the "series" property of the chart. This will be an array of BarSeries objects.
    You may also need to set the horizontalAxis and verticalAxis properties for the chart. (I forget if there are defaults for these.)

  • How to change IR font size (only) dynamically

    Hi,
    On blog http://www.danielmcghan.us/2009/01/that-font-is-too-small.html, there was a nice example how to change IR font size on the fly.
    Some how seems that this is not working new Responsive 25 theme, which is not having "td" . So could anyone help me.
    I'd like to add some saving ability to some table (user preferences table) ... sou please expand that example if possible.
    For that I made it on Apex cloud demo: FONT_SIZE_ADJ_APP
    http://apex.oracle.com/pls/apex/f?p=2354
    Login data:
    UN : guest_admin
    PWD: Qwertz123!
    THX in advance for your help.
    Brg,
    Damir

    Th actual code from the working example looks different from the blogpost
    May be worth trying this code (in your page template)
    <td style="white-space:nowrap"><span id="decreaseFont">(-) </span><span id="saveFont">Save</span><span> / </span><span id="resetFont">Reset</span><span id="increaseFont"> (+)</span></td><u>For saving this into a custom user preferences table:</u>
    - you can amend the application process RETURN_NOTHING to insert/update using the item FONT_SIZE_ADJ
    And add computation to set the value into FONT_SIZE_ADJ from the user preferences table for the first time when users login

  • How do i implement dynamic feature like arraylist in an array

    how do i implement dynamic feature like arraylist in an array

    funny
    but can u realy give me that code

  • Multiple Comboboxes with single instance of Array Collection

    First off - thanks to everyone for their contributions.  This forum provides a lot of good information.
    I'm stuck on a particular problem and I suspect I'm not thinking about the issue correctly.
    I'm developing a dynamic module that instantiates components at runtime based on an XML scheme.  Many of these components are drop-downs that are chained togther (a selection in one drives the population of the next)
    I loop through the initial XML document to create and layout the components.  I have been using a single Array Collection to populate the drop-down.  This worked fine with the chained comboboxes since I only load one combox initially.  However, when I add a couple of static combo boxes, the arraycollection seemed to be binding to the orginal combobox.  For example, if I create 3 combo boxes they have drop-down values that display all 3 lists appended together.  I was a bit surprised because I didn't think that I could bind an Array Collection.  I certainly haven't defined a Binable ArrayCollection.
    I thought I could solve the issue by simply creating a unique Array Collection at runtime - one for each element.  However, I don't think this is possible or I can't figure out how to create a new Array Collection with a dynamic name - something like this:
    I was hoping this would work -
    var newDropDown_[numOfElement]:ArrayCollection = new ArrayCollection(); 
    I've tried to use a Dictionary object to store each ArrayCollection.  I couldn't get that to work properly.
    Essentially - my code loops on the number of components to add:
    for (var i:int = 0; i < numFormElements; i++)
              for (var j:int = 0; j < numvalues; j++)
                                    var valuefield:String = 'value_' + [j+1];
                                    var obj:Object=new Object();
                                    obj.label=instFields[i][valuefield].@label;
                                    obj.data=instFields[i][valuefield].@data;
                                    newDropDown.addItemAt(obj,j);
    Then I add the components:
              var c:ComboBox = new ComboBox ();
                c.labelField='label';
                c.name=numberOfElement.toString();                                  
                c.dataProvider=    newDropDown;
                _h1.addChild(c);
                numComboDropDwns.push(c);
    I need a way of looping, getting data and populating each component independently??
    Any ideas?
    Thanks,
    John

    I went a different route and solved the issue.  For someone looking at a similar problem - this what I ended up doing:
    I just loaded one array collection with data for all of the drop-downs on the form.  I then populated each dataprovider with individual elements from the array.
    for (var i:int = 0; i < numFormElements; i++)
    for (var j:int = 0; j < numvalues; j++)
                                    var valuefield:String = 'value_' + [j+1];
                                    var obj:Object=new Object();
                                    obj.label=instFields[i][valuefield].@label;
                                    obj.data=instFields[i][valuefield].@data;
                                    newDropDown.addItemAt(obj,elementCounter);
                                    elementCounter = elementCounter + 1;
    I keep track of the element #, number of values for each element and the overall index for the array.
    Each data provider is then loaded with the subset from the array:
    for (var z:int = (_counter - _numvalues) ; z < _counter; z++)
                                var _label:String=    newDropDown.getItemAt(z).label.toString();
                                var _data:String = newDropDown.getItemAt(z).data.toString();
                                c.dataProvider.addItem({label:[_label],data:[_data]});
    This seems to work nicely - each component is created and loaded with only their data.  I spent 3 days searching for a way to create a dynamic arraycollection at runtime.  I don't think it's possible - but I'm not sure it was the best method anyway.

  • How do you save dynamic data type, from the DAQ assistant, for use in Excel or matlab?

    Currently, I have the following basic VI setup to save Data from my PCI6221 Data Aquisition Card.  The problem I'm having is I keep getting the last iteration of the while loop in the measurement file and that's pretty much it.  When I try to index the data leaving the loop it gives me a 2D array of Data which cannot be input into the "Write to Measurement File" VI.  How would I save this to a useful Data/time step format?  I was wondering of a way to continuously collect the Data and then save it in a large measurement file that I would manipulate in Matlab/excel?  Am I using the wrong type of loop for this application?  I also noticed my Dynamic Data array consists of data, time, timestep and then a vector of the data taken.  Is it possible to just get a vector of the time change per sample alongside the data?    Sorry for the barrage of questions but any help would be greatly appreciated, and thanks in advance!
    -Bryan
    Attachments:
    basic DAQ.vi ‏120 KB

    There is a VI in the Express > Signal Manipulation palette called "From DDT" that lets you convert from the Dynamic Data Type to other data types that are more compatible with operations like File I/O....for instance, you could convert your DDT into a 2D array and use the Write To Spreadsheet File.vi.  Just a thought...
    -D
    Darren Nattinger, CLA
    LabVIEW Artisan and Nugget Penman

  • Loading COBOL file - blocked variable records and varying size arrays

    We would like to use ODI 11g to regularly to parse and load into Oracle DB 11g complex files that originate on the MVS mainframe.
    Key file characteristics are:
    1. EBCDIC encoding
    2. file contains blocked records - each block starts with a 4-byte Block Descriptor Word (BDW). BDW bytes 1-2 specify the block length stored as a 16-bit unsigned integer, i.e. PIC (5) COMP in COBOL.
    3. each file block contains multiple variable size records - BDW is followed by 1 or more variable length records. Each record starts with a 4-bytes Record Descriptor Word (RDW). RDW bytes 1-2 specify the record length stored as 16 bit unsigned integer, i.e. PIC (5) COMP in COBOL.
    4. each file record contains number of scalar fields and several varying-size arrays - COBOL OCCURS DEPENDING ON. For example:
    03 SAMPLE-ARRAY-CNT PIC S9(1) COMP-3.
    03 SAMPLE-ARRAY OCCURS 0 TO 5 TIMES DEPENDING ON SAMPLE-ARRAY-CNT.
    05 ARRAY-CD1 PIC X(5).
    05 ARRAY-CD2 PIC X(7).
    05 ARRAY-AMOUNT PIC S9(3)V9999 COMP-3.
    5, file contains fields stored as COBOL COMPUTATIONAL and COMPUTATIONAL-3.
    6. average record lengh is 1,000 bytes and each file is about 4GB
    SQL*Loader/external table functionality can handle most of these requirements on one-off basis, but collectively they present a significant challenge. The file layout can't be reversed engineered as COBOL copybook into ODI.
    Does ODI have complex file parsing capabilities that could be used to (pre-)process the file, in as few passes as possible?
    Thanks
    Petr

    Hi,
    there's a couple of options here, and I've included what I think is the simplest below (using TestStand 2.0.1).
    It's not exactly elegant though. What I've done is to put in a step that finds out the number of steps to load (based on an earlier decision - in this case a message popup step). I read a number from the limits file, and use this in the looping options of the property loader step that's loading the values into the array. I've done it with a fixed size array target here, big enough to take any incoming data. (Otherwise, knowing how many items you're going to load from the limits file, you could start with an empty array and re-size it prior to loading).
    I've cheated slightly by using the pre-expression on the property loader step to specify where th
    e data is coming from and where it's going to in the sequence on each iteration of the loop based on the Runstate.Loopindex.
    Another option is to go straight into the property loader step, and keep loading properties until the Step.Result.NumPropertiesRead = 0 (remember we're only doing this one at a time)
    Another idea would be to load in a value, and check it isn't a "flag" value (i.e. you'd never use say 999 in your array, so set the last element in your limits file to this, and drop out of the loop when this happens.
    Further still, you've got the source code for the property loader step, so you could re-write it to make a custom step that loads an array until it fails all on its own (no looping in TestStand).
    Hope this gets you going
    S.
    // it takes almost no time to rate an answer
    Attachments:
    DynamicPropertyLoader.seq ‏32 KB

  • Dynamic string array

    I need to make a dynamic string array.
    Deeper explanation:
    I am trying to use a FOR loop to send a series of commands to an 8-channel device.  Each channel requires 7 (actually, 1/2 need only 5, the other 1/2 need 7) strings to set them up and the entire sequence needs to be performed 8 times.  I started a test .vi by simply using a constant array of type sting.  I can sequentially pick each string and program my device perfectly.  Now I'd like to do things like add the channel # somewhere in the mix, use variable values based on other controls in my .vi to set the parameters of the channel.
    EXAMPLE:
    The user sets certain values that determine delays and width for an 8-channel DDG (Digital Delay Generator, to some, a pulse generator).  These values then need to be loaded into the DDG.  The Strings will look something like this:
    ULSE1TATE 1
    ULSE1:WIDTH 0.009 000           *NOTEpaces behind decimal are for better viewability only
    ULSE1ELAY 0.000 000
    ULSE1YNC T0
    ULSE1:CMODE DUTY
    ULSE1COUNTER 1
    ULSE1:BCOUNTER 1
    ULSE2TATE 1
    ULSE2:WIDTH 0.000 300
    ULSE2ELAY 0.008 700
    ULSE2YNC T0
    ULSE2:CMODE NORMAL
    So widith and delay params change, the pulse# changes, and whether it's on certain channels decides if the mode is duty or normal and duty comes with the subsequent params pcount and bcount.
    help?
    PS - I am going to move the state, sync, and cmode to a common, initialize loop run only at program start, but I still need to use width, delay, and (variably) pcount and bcount.
    PPS - I am trying to edit post to diable smilies.  Commands should read:"colon, P (or D)" not ,
    PPPS - Success, at least for me.  I disabled smilies in my settings, I don't know if that means my posts won't show smilies or if just what I am looking at won't show smilies, any responders let me know how it's showing for you.
    Message Edited by Radiance_Jon on 07-16-2007 01:48 PM
    Message Edited by Radiance_Jon on 07-16-2007 01:52 PM

    smercurio_fc wrote:
    Well, in my experience I have found that dealing with errors early on is the best course of action as it leads to less headaches down the road...
    Auto-indexing is one of the more powerful features of LabVIEW. If you're familiar with text-based languages it's equivalent to the "foreach" statement. Basically it allows you to wire an array into a for-loop and the size of the array tells LabVIEW how many times the loop needs to execute. Inside the loop LabVIEW peels of each element of the array in order for each iteration of the loop. Looks like this:
    My comment regarding not needing the sequence frame was related to using the error cluster since that wire would allow you enforce data dependency like so:
    Note that the VISA resource wire does the same thing.
    "I got a little aggravated at how NI seemed to handle the loops in those two frames concurrently".  That's because LabVIEW is a data-flow language, and not a sequenced language like C or VB. In fact, that's one of the things that makes LabVIEW so powerful.
    Message Edited by smercurio_fc on 07-16-2007 04:48 PM
    MAN!  I KNEW that!!!!  GGRRRRR!!!  That makes sense.  Actually that's WHY I connected the error lines in the first place was to aide in flow control.  OH!!!  Still getting used to LabVIEW. 
    But I still have a question related to flow control.  Check out the pic below.  LabVIEW runs everything in a seemingly random order... well at least where it STARTS each chain of data.  It obviously starts with the static constants or the earliest data in each chain, but I can't figure out how in the world it's deciding WHICH chain to start first.  It kind of seems to go with the lower right and work it's way to top-left, but it doesn't exactly do that either.  I dunno if it's worth you answering this concern or not, but if you got one for me I'd be much obliged. 
    I should take a LabVIEW class!  Yeah right, as if they'd let me... R&D means I won't need it tomorrow ;( which stinks cause I'm liking LabVIEW the more I learn it.  (I was not fond of it in the beginning, but that was my stubborness). 
    thanks again so much for all your help!!!!
    Also, I am using all those strings to make my display appear as I want it to... I wonder if there is another way?  I am aware of system labels, but I like the look of the recessed, grayed control boxes better.
    Message Edited by Radiance_Jon on 07-16-2007 05:06 PM

  • Creating dynamic sized arrays and filling them automatically on speedy 33

    hi all,
    I am trying to create dynamic sized arrays on Speedy-33. Specifically, depending on the user input, I want to be able to create
    arrays with 128 or 256 elements and fill them automatically. However,
    array constant element is fixed for Speedy 33; thus I have to manually set the
    size of the array with the mouse and enter the values in to the array by
    myself. I want to make this tedious process automatic. Would this be possible? thanks so much for comments!
    ~casiopea

    Casiopea,
    There is a really great article on using arrays with LabVIEW DSC which can be found here:
    How Can I Be Successful With Arrays In the LabVIEW DSP Module?
    One of the biggest things that should be noted about DSP is that there is no dynamic memory allocation.  Your array size must be fixed, and thus, your array needs to be initialized by using a constant. 
    An easy way to initialize an array constant that has many elements that are all the same is to simply create a numeric constant that has the value that you want.  Then, create a new blank array constant and drag the numeric into it.  In the index input for the array constant, type in the index of the last element that you want to be initialized.  Then type in the value in the element that is displayed and all of the elements before it will be initialized to the default value of the numeric constant that you dropped into the array constant.  I hope this helps.  I would really recommend reading through that article, as it has a lot of great information about using arrays with DSC.
    Brian Coalson
    Software Engineer
    National Instruments

Maybe you are looking for