How to handle ever expanding array?

Hi,
I'm looking for help with a temperature control experiment...
I have a program to aquire data from 24 channels through a while loop.
I am displaying the data in a waveform graph. Currently, I am using
shift registers and build array to add new data to the graph every time
through. This worked fine while I was prototyping the hardware, but now
I'd like it to run for days on end; as everyone can imagine, the array
keeps getting bigger and the build array function keeps hogging memory
until the whole thing crashes.
I'm guessing that I should be writing the data to a file every so
often, which would keep the size manageable, and would allow me to know
the size of the array and could use other opperations rather than build
array. The array would need to stay pretty small so the write operation
didn't slow down the loop too much. The program is pretty slow, since
I'm limited in how quickly I can
change temperatures. Currently, I go through all 24 probes about every
2.5 seconds (this is set just by how long it takes the routine to read
each temperature and calculate the control parameters). If it takes a
little bit longer each time through, that's not a huge problem, but a
big pause every so often would make the control routine behave oddly.
What the save-to-file option takes away, however, is the ability to
walk up to the machine in the morning and see at a glance how well it
regulated the temperature during the night. I've thought about keeping
some reduced set of the data (every minute or so) to give me a
low-frequency glance at the data, but it seems like this will simply
postpone the inevitable memory loading. I don't know if I could have a
separate program that opened up the files that the control routine
wrote, but this would probably be too much for the poor old PII machine
that is running this.
Does anyone have a simple solution to this probelm? Failing that, a
complex solution might do, although it might get beyond my programming
abilities.
I only have LV 6.0, so I can't see examples saved for versions later than this.
Thanks for any suggestions.
cheers,
mike

Mike,
Writing data to an array every so often is definitely what you want to do. Then if power fails or the program shuts down for some reason, the data to the last save is still in the file. At the 2.5 second sample rate you only get ~35000 points per channel per day, so data files will not get too large. Decide how often to write by how valuable the data is: What is the penalty for losing data for the last minute, hour, day...?
Another point is that the panel display only occupies a few hundred pixels in each direction. Plotting more points than that is meaningless. If you plot one point per minute you will have 1440 points per day (per channel). You could always show the most recent 24 hours using a circular buffer. With more programming effort, you could keep previous days plots available for selection by the user or read them back from the file.
Lynn

Similar Messages

  • Ever-expanding array

    Is it possible to implement an ever-expanding array (without the help of vector and arraylist java utils) starting from:
    String[] wordList = new String[1];And expands whenever a new word has been added to the array. Every element of the array must store a word and there should be no null values.. Is this even possible?

    Nope, I'm afraid not. If you need an expanding array, try an ArrayList.

  • How to handle a second array?

    Hi all,
    I tried to add in a second array, but I got an error that said "unreachable code" for each aspect I entered using array b(the second array).
    // IntegerSet.java
    public class IntegerSet {
      private int [] a;  // holds a set of numbers from 0 - 100
      private int [] b;  // also holds numbers 0 - 100
      public IntegerSet () {
        // an empty set, all a[i] are set to 0
        a = new int [101];
        b = new int [101];
      // A constructor that copies from an existing set.
      public IntegerSet (IntegerSet existingSet) {
        a = new int [101];
        b = new int [101];
        for(int i=0; i<a.length; i++)
          a[i] = existingSet.a;
    for(int i=0; i <b.length; i++)
    b[i] = existingSet.b[i];
    public void deleteElement(int i) {
    if ((i >= 0) && (i < a.length))
    a[i] = 0; // set to 1
    if ((i >= 0) && (i < b.length))
    b[i] = 0;
    public void insertElement(int i) {
    if ((i >= 0) && (i < a.length))
    a[i] = 1; // set to 1
    if ((i >= 0) && (i < b.length))
    b[i] = 1; // set to 1
    public boolean isSet(int i) {
    return (a[i] == 1);
    return (b[i] == 1);
    // The union of this set and another set
    public IntegerSet unionOfIntegerSets(IntegerSet otherSet) {
    IntegerSet newSet = new IntegerSet(this);
    // newSet is now a copy of the current set. Next we want to union with set a
    for(int i=0; i<a.length; i++) {
    if (otherSet.isSet(i))
    newSet.insertElement(i);
    for(int i=0; i<b.length; i++) {
    if (otherSet.isSet(i))
    newSet.insertElement(i);
    return newSet;
    // The intersection of this set and another set
    public IntegerSet intersectionOfIntegerSets(IntegerSet otherSet) {
    IntegerSet newSet = new IntegerSet(this);
    // newSet is now a copy of the current set. Next we want to intersect with set a
    for(int i=0; i<a.length; i++) {
    if (!otherSet.isSet(i))
    newSet.deleteElement(i);
    for(int i=0; i<b.length; i++) {
    if (otherSet.isSet(i))
    newSet.deleteElement(i);
    return newSet;
    // return true if the set has no elements
    public boolean isEmpty() {
    for (int i=0; i<a.length; i++)
    if (isSet(i)) return false;
    return true;
    for (int i=0; i<b.length; i++)
    if (isSet(i)) return false;
    return true;
    // return the 'length' of a set
    public int returnLength() {
    int count = 0;
    for (int i=0; i<a.length; i++)
    if (isSet(i))
    count++;
    for (int i=0; i<b.length; i++)
    if (isSet(i))
    count++;
    return count;
    // Print a set to System.out
    public void setPrint() {
    System.out.print("[Set:");
    if (isEmpty())
    System.out.print("---");
    for (int i=0; i<a.length; i++) {
    if (isSet(i))
    System.out.print(" " + i);
    for (int i=0; i<b.length; i++) {
    if (isSet(i))
    System.out.print(" " + i);
    System.out.print("]\n");
    // return true if two sets are equal
    public boolean isEqualTo(IntegerSet otherSet) {
    for(int i=0; i<a.length; i++) {
    if (otherSet.isSet(i) != isSet(i))
    return false;
    return true;
    for(int i=0; i<b.length; i++) {
    if (otherSet.isSet(i) != isSet(i))
    return false;
    return true;
    // Small test program to verify that IntegerSet works!
    public static void main (String [] args) {
    IntegerSet smallEvens = new IntegerSet();
    IntegerSet smallOdds = new IntegerSet();
    for (int i=0; i < 101; i++)
    if ((i % 2) == 0)
    smallEvens.insertElement(i);
    else
    smallOdds.insertElement(i);
    System.out.print("smallEvens: ");
    smallEvens.setPrint();
    System.out.print("smallOdds: ");
    smallOdds.setPrint();
    IntegerSet union = smallEvens.unionOfIntegerSets(smallOdds);
    System.out.print("union: ");
    union.setPrint();
    IntegerSet intersection = smallEvens.intersectionOfIntegerSets(smallOdds);
    System.out.print("intersection: ");
    intersection.setPrint();
    // Output:
    // smallEvens: [Set: 0 2 4 6 8]
    // smallOdds: [Set: 1 3 5 7 9]
    // union: [Set: 0 1 2 3 4 5 6 7 8 9]
    // intersection: [Set:---]
    I'm guessing I probably put the braces wrong or something. Any ideas on how to fix this? I appreciate any help given. Thanks.

    All right, I edited part of the code, and put in comments to where the error occurs.
    public class IntegerSet {
      private int [] a;  // holds a set of numbers from 0 - 100
      private int [] b;  // also holds numbers 0 - 100
      public IntegerSet () {
        // an empty set, all a[i] are set to 0
        a = new int [101];
        b = new int [101];
      // A constructor that copies from an existing set.
      public IntegerSet (IntegerSet existingSet) {
        a = new int [101];
        b = new int [101];
        for(int i=0; i<a.length; i++)
          a[i] = existingSet.a;
    for(int i=0; i <b.length; i++)
    b[i] = existingSet.b[i];
    public void deleteElement(int i) {
    if ((i >= 0) && (i < a.length))
    a[i] = 0; // set to 1
    if ((i >= 0) && (i < b.length))
    b[i] = 0;
    public void insertElement(int i) {
    if ((i >= 0) && (i < a.length))
    a[i] = 1; // set to 1
    if ((i >= 0) && (i < b.length))
    b[i] = 1; // set to 1
    public boolean isSet(int i) {
    return (a[i] == 1 && b[i] == 1);
    // The union of this set and another set
    public IntegerSet unionOfIntegerSets(IntegerSet otherSet) {
    IntegerSet newSet = new IntegerSet(this);
    // newSet is now a copy of the current set. Next we want to union with set a
    for(int i=0; i<a.length; i++) {
    if (otherSet.isSet(i))
    newSet.insertElement(i);
    for(int i=0; i<b.length; i++) {
    if (otherSet.isSet(i))
    newSet.insertElement(i);
    return newSet;
    // The intersection of this set and another set
    public IntegerSet intersectionOfIntegerSets(IntegerSet otherSet) {
    IntegerSet newSet = new IntegerSet(this);
    // newSet is now a copy of the current set. Next we want to intersect with set a
    for(int i=0; i<a.length; i++) {
    if (!otherSet.isSet(i))
    newSet.deleteElement(i);
    for(int i=0; i<b.length; i++) {
    if (otherSet.isSet(i))
    newSet.deleteElement(i);
    return newSet;
    // return true if the set has no elements
    public boolean isEmpty() {
    for (int i=0; i<a.length; i++)
    if (isSet(i)) return false;
    return true;
    for (int i=0; i<b.length; i++) // unreachable statement
    if (isSet(i)) return false;
    return true;
    // return the 'length' of a set
    public int returnLength() {
    int count = 0;
    for (int i=0; i<a.length; i++)
    if (isSet(i))
    count++;
    for (int i=0; i<b.length; i++) // unreachable statement
    if (isSet(i))
    count++;
    return count;
    // Print a set to System.out
    public void setPrint() {
    System.out.print("[Set:");
    if (isEmpty())
    System.out.print("---");
    for (int i=0; i<a.length; i++) {
    if (isSet(i))
    System.out.print(" " + i);
    for (int i=0; i<b.length; i++) {
    if (isSet(i))
    System.out.print(" " + i);
    System.out.print("]\n");
    // return true if two sets are equal
    public boolean isEqualTo(IntegerSet otherSet) {
    for(int i=0; i<a.length; i++) {
    if (otherSet.isSet(i) != isSet(i))
    return false;
    return true;
    for(int i=0; i<b.length; i++) {
    if (otherSet.isSet(i) != isSet(i))
    return false;
    return true;
    // Small test program to verify that IntegerSet works!
    public static void main (String [] args) {
    IntegerSet smallEvens = new IntegerSet();
    IntegerSet smallOdds = new IntegerSet();
    for (int i=0; i < 101; i++)
    if ((i % 2) == 0)
    smallEvens.insertElement(i);
    else
    smallOdds.insertElement(i);
    System.out.print("smallEvens: ");
    smallEvens.setPrint();
    System.out.print("smallOdds: ");
    smallOdds.setPrint();
    IntegerSet union = smallEvens.unionOfIntegerSets(smallOdds);
    System.out.print("union: ");
    union.setPrint();
    IntegerSet intersection = smallEvens.intersectionOfIntegerSets(smallOdds);
    System.out.print("intersection: ");
    intersection.setPrint();
    // Output:
    // smallEvens: [Set: 0 2 4 6 8]
    // smallOdds: [Set: 1 3 5 7 9]
    // union: [Set: 0 1 2 3 4 5 6 7 8 9]
    // intersection: [Set:---]

  • How to handle massive array operations

    Hi!,
    We are working with large arrays of the order of 5000 x 100000 (rows x col).
    We wish to perform typical array operations like replace subset, indexing, rotating and addition.
    Our questions:
    1) How do we work with this array within the same VI without creating indicators or controls. Wiring, we understand, is an option but then the wires will clutter our screen.
    2) How do we pass/retrieve this array data to/from sub-VIs without creating indicators or controls.
    3) What the fastest recommended methods of handling such large arrays.
    4) Our array will be either Boolean or U8. Will both data types give similar speed results?
    5) When using the replace subset function, can the subset be same dimension as original array?
    6) Can we rotate a particular row within a 2D array? As of now, we extract the row as 1D, rotate and then replace the original row with rotated row.
    Any ideas/suggestions (specific to array handling) to help speed our VI will be highly appreciated.
    We are using LV 7.1 on Win2000
    Thanks,
    Gurdas
    Gurdas Singh
    PhD. Candidate | Civil Engineering | NCSU.edu

    Saverio, Joe, Jason and Benoit - Thanks!
    Reply to Saverio's inputs:
    (1) Not sure what you mean by this. If you need to work with that data in the same VI you use wires - that's the most efficient way of doing it. Are you thinking about local variables or something?
    No, we avoid locals like birdflu! What I meant was how do I carry data from one part of my block diagram (BD) to another without using wires (because wires clutter the block diagram)? Is there no variable/container which will hold data without it being a control/indicator? Some of my front panels will be displayed. In such VIs, the moment I use a control/indicator in the BD to "hold" my data, my speeds drop.
    (2) OK
    (3) OK
    (4) LabVIEW stores Booleans as 8-bit data. You should choose the one that makes more sense for your application.
    U16 makes most sense.
    U8 also does the task, only catch is at the end I need to convert the array into U16 for the last operation to happen (all elements in a col are added; thus final array is 1D row array).
    I would use Boolean ONLY if it gives significant speed gains over U8 (I will need to convert Boolean to U16 at the end).
    Any inputs/ideas?
    (5) OK
    (6) You will need to be a little more specifc about this one, though I suspect the Transpose 2D Array function coupled with the Replace Array Subset is what you're looking for.
    Lets say the first row of my 2D array has 5 elements, which are 3 6 12 8 1. I want this to become 12 8 1 3 6. In effect I left rotated my first row my two positions.
    Rgds,
    Gurdas
    Gurdas Singh
    PhD. Candidate | Civil Engineering | NCSU.edu

  • If i load 1GB file in labview array, it shows memory full. How tom handle it?

    if i load 1GB file in labview array, it shows memory full. How tom handle it?

    Don't read it all at once.  Just read the parts you need when you need it.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Thoughts on how LabVIEW handles checkout of file from SCC when file already open

    When you already have a file/project open in LabVIEW and it is set to read only because you haven't checked it out, you can go into SCC and do a checkout then save the file immediately. The issue with this is, if your local copy doesn't match the copy in SCC, you will probably be overwriting changes. Sometimes this is convenient because if you have ever edited a MS Word file and then gone to save and it won't let you because it was opened as read-only...then that sucks because you either lose your work, or have to do a copy of the entire word file->close the program->re-open as writable, then paste. This can be avoided with the "LabVIEW way", but the "MS Word" way seems much safer because it forces you to conscioiusly make the file writable (by either checking it out or manually write clicking and changing to writable) BEFORE opening it. I just wanted people's opinions on how LabVIEW handles this, and if there would be a better way.
    CLA, LabVIEW Versions 2010-2013

    VSS 
    CLA, LabVIEW Versions 2010-2013

  • How to handle multiple records in BPMN process

    Hi All,
    We are using Oracle BPM 11g.In my requirement,I am using the database adapter to get the data from table and I need to validate the each record and update the status of that record from the BPM Process.But I dont know how to handle if multiple records come at a time.Can anybody please helpout from this problem.
    Thanks in advanced.
    Narasimha Rao.

    Can you have a look at this post: http://redstack.wordpress.com/2010/09/30/iteratingtraversing-arrays-in-bpm/
    It's solving a different problem, but the key is that it's using a multi-instance subprocess to iterate over an array of "things" that need to be acted in. In your case it's the set of results from the db query rather than the set of tests in the example. But the principle is the same. You'd take collection of rows from the DB and process them in a multi-instance subprocess. The text that begins with the following would be good place to start:
    "Now let’s implement the body of our process. We will use the Subprocess object to handle the traversal of the array of tests. Drag a Subprocess from the component palette on the right into the process and drop it on the line between the Start and End nodes."
    In the loop characteristics you'd define whether you want to execute serially or in parallel.

  • How to share structure with arrays in a single file between C# and C with arrays?

    It is possible to define things so that a file that contains a struct definition can be included in both C# and C programs once the differences are taken into account. Most of these differences can be handled but not all. One of those problems is arrays.
    Here's a contrived example of a file that can be imported directly into either a C or a C# project. If '__c__' is defined then the file is being imported into a C++ project. If not then the file is being consumed by a C# project. This simple little
    thing allows those things that are different between the two environments to be taken into consideration. The one really knotty problem is how to handle arrays. In C, an array can be given a fixed size in a struct. Not so in C#. C# generates a compile time
    error. I've been working around it so far by numbering the elements in the C# branch.
    // If '__c__' is defined then the file is being included in a C project.
    // If not then the file is being included in a C# project.
    #if !__c__
    // C# can utilize a namespace. C cannot.
    namespace CrossPlatform
    // C# wants to include the struct in a class.
    public class Structs
    #endif
    #if __c__
    // C defines a struct as a named typedef.
    typedef struct _RtInfo
    #else
    // C# wants a struct object with a name.
    public struct RtInfo
    #endif
    // Simple value types and previously defined structures
    // can be shared directly between both C and C#.
    float f;
    #if __c__
    // Arrays cannot be shared. C can use arrays with a size.
    int v[4];
    #else
    // but C# cannot deal with sized arrays at all.
    int v0;
    int v1;
    int v2;
    int v3;
    #endif
    #if __c__
    // C optionally gives the struct a name.
    } CALDATA;
    #else
    // C# does not do that here.
    #endif
    #if !__c__
    } // end of class.
    } // end of namespace block wrapper.
    #endif
    Richard Lewis Haggard

    Hi
    Richard.
    Would you mind letting us know the result of the suggestion?
    I temporarily mark
    Viorel’s last response as an answer. You can unmark
    it if they provide no help.
    Best regards,
    Kristin
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How can I build an array not knowing final size at startup?

    Hi,
    I need to be able to build an array with a certain number of rows but that number is not known at runtime. Instead it can't exceed 5 in a certain time period. So my question is: every 20 seconds I need to send out the 5 row array but if lets say 10 rows of data come in in 20 seconds I am not sure how to handle the data to have it build 2 arrays and send them out one after another at the elapse of the 20 seconds as opposed to just sending an array with 10 rows and losing half the data on the receiving side. Please any help will be appreciated,
    Alex

    I understand that you have to send a least a message every 20 seconds (could be empty ?), but can you send more messages if you get more data (e.g. 3 message of 5 rows in 20 sec) ?
    If you can, then all you have to do is to trigger the sending of a message each time the array size reaches 5, or if 20s ellapsed since last sent message.
    Here is an example, using shift registers. there is a random data generation so that you can see it working (if you set the time between data long enough, then you will see the data sent after 20 sec. Well not exactly 20 sec, but i guess you can figure this out later by yourself...)
    I hope this will be of any help
    Attachments:
    dynamic_array.vi ‏36 KB

  • Drive Utility Help Viewer "does not know how to handle selected URL"

    I have Drive Utility 10.5.6, according to . I'm trying to reformat a FAT32 partition on an external drive to Mac OS X Ext. Journaled in preparation for using SuperDuper to back up my Mac HD boot partition. For a time, which seems to have passed, now that erasing the partition has been done. The Disk Utility Help wouldn't work. Instead of putting up topic information, I got a message saying "Help Viewer does not know how to handle selected URL", followed by an reference to an html file that allegedly existed inside a set of folders inside the app. Where, of course, Finder cannot see. Once the erasing was done, Help seems to have come back. I tried Apple Support, but could only get a reference to OS 9 Appleworks macros not working in OS X. No help at all. Is this a question? I don't know. Help is working now. But for a while it was very annoying. It must be one of those little windows glitches that no one ever bothered to fix.

    In order to change a FAT or NTFS formatted drive for use with OS X you will need to do the following:
    Extended Hard Drive Preparation
    1. Open Disk Utility in your Utilities folder.
    2. After DU loads select your hard drive (this is the entry with the mfgr.'s ID and size) from the left side list. Click on the Partition tab in the DU main window.
    3. Under the Volume Scheme heading set the number of partitions from the drop down menu to one. Set the format type to Mac OS Extended (Journaled.) Click on the Options button, set the partition scheme to GUID (for Intel Macs) or APM (for PPC Macs) then click on the OK button. Click on the Partition button and wait until the process has completed.
    4. Select the volume you just created (this is the sub-entry under the drive entry) from the left side list. Click on the Erase tab in the DU main window.
    5. Set the format type to Mac OS Extended (Journaled.) Click on the Options button, check the button for Zero Data and click on OK to return to the Erase window.
    6. Click on the Erase button. The format process can take up to several hours depending upon the drive size.
    If you have an Intel Mac and can partition the drive using GUID then you can have FAT32 and OS X partitions on the same drive.
    As for problems with the Help viewer see:
    In most cases doing the following will restore the Help Viewer:
    1. Trash the following three files, if extant:
    /Home/Library/Preferences/com.apple.help.plist
    /Home/Library/Preferences/com.apple.helpui.plist
    /Home/Library/Preferences/com.apple.helpviewer.plist
    2. Trash the /Home/Library/Caches/com.apple.helpui folder.
    3. Empty the Trash and Restart.
    Visit The XLab FAQs and read the FAQ on the Help Viewer for additional suggestions.

  • How to handle this kind of scenario in SBO

    Hello, I am new to SAP Business One. I would like to know how to handle Transporation Company scenario below in SBO.
    QUESTION 1: A transportation company has 30 truck. The company receives orders from the customer and use the trucks to deliver the goods from Point A to Point B everyday. The cost for delivery is $0.50 per-KG.
    The way I handle above:
    1. In ITEM MASTER DATA:
    Create a new item > Item Type: Labor > Description: Delivery from Point A to Point B > and determine the delivery price is $0.50.
    2. Use the item created in no 1 above when creating Sales order/Invoice.
    If the weight is 5000kg then simply put QTY 5000 in Sales Order with the price of $0.50/KG, which has been set in Item Master Data.
    Is the above method correct or there is better way to handle?
    QUESTION 2: TRACKING EACH TRUCK EXPENSES BY ITS LICENSE PLATE:
    Each truck has Spare Parts expense (e.g. bulbs, oil, battery, tires etc) that the company would like to track.
    The company purchased the spare parts from suppliers and keep it in the warehouse. When a truck needs to replace its spare parts, the company will issue the parts and record it under that truck's license number as that truck's expense.
    The goal is SBO must be able to provide detail monthly expense report for each truck when inquired by its license plate. I prefer NOT to manually input "directly" in Journal Entry to prevent error.
    Thanks.

    Hi,
    welcome to sbo forum!
    For your question 1, it will depend if you will only have 1 route for all of your deliveries.If your point of origin is always point a then destination is point B w/ price of $0.50,then you are right with your process... but if you will have to expand and move into different places, i think it will best for you to create a UDT for your pricing.
    in summary:
    1.create UDT pricing(with origin,destination and price)
    2.Create UDF in row level of Sales order(U_origin,_U_destination)
    3.) create FMs for your Sales order Origin and destination based on UDT Pricing table.
    4.) create automatic fms for your price( based on origin and destination selection).
    for question 2, all your repairs and maintenance will pass through AP invoice( either by item or service). in our country we normally use Ap service,since a truck has normally several types of spare parts. This figures will will surely add up to the number of item master data record in your system ,since you will need create a unique item for each and every item available.
    -To monitor all your expenses, you will need to create a UDF in the header of PO, GRPO or AP invoice, place your plate number here. so that when you extract your reports, you will easily identify your expenses per truck.
    in summary:
    1.create UDF for header of PO,GRPO or AP( Udf_Plate number) you can set valid values for you udf or by FMS with default values.
    2.Create Udf for lines of PO,GRPO or ap(UDF_spare part type) --note: if you will use the Item type document for repairs and  maintenance then i guess you dont need to add UDF_spare parts.
    Hope i was able to help you.
    Regards,
    Darius Gragasin

  • How to handle error while using dbms_sql.execute

    Hi,
    I am inserting some records by using the following piece of code.
    stmt := 'insert into SSI_KPI_GOAL_VALUE_H (KPI_VAL_KPI_ID, KPI_VAL_RM_CDE,'|| v_day_value ||',KPI_VAL_ACT_DLY,'||v_month_val||',KPI_VAL_BIZ_UNIT_CDE) values (:kpi_array,:rm_array,:day1_array,:day1_array,:day1_array,:busnunit_array)';
    l := dbms_sql.open_cursor;
         dbms_sql.parse(l, stmt, dbms_sql.native);
         dbms_sql.bind_array(l, ':kpi_array', col1_ins,1,ins_cnt-1);
         dbms_sql.bind_array(l, ':rm_array', col2_ins,1,ins_cnt-1);
         dbms_sql.bind_array(l, ':day1_array', col3_ins,1,ins_cnt-1);
         dbms_sql.bind_array(l, ':busnunit_array', col4_ins,1,ins_cnt-1);     
         dummy := dbms_sql.execute(l);
         dbms_sql.close_cursor(l);
    I am getting an error since any one of the row contains value larger than the column.
    How to handle exception handling for those rows which is having errors. I would like insert the records which is having
    no errors. Like SAVE EXCEPTIONS for 'forall' is there any option is available to handle exceptional records.
    Please help.
    Thanks & Regards,
    Hari.

    Hari,
    What's oracle version? Are you looking for something similar to this? see following example
    DECLARE
       TYPE array
       IS
          TABLE OF my_objects%ROWTYPE
             INDEX BY BINARY_INTEGER;
       data          array;
       errors        NUMBER;
       dml_errors exception;
       error_count   NUMBER := 0;
       PRAGMA EXCEPTION_INIT (dml_errors, -24381);
       CURSOR mycur
       IS
          SELECT *
          FROM t;
    BEGIN
       OPEN mycur;
       LOOP
          FETCH mycur BULK COLLECT INTO data LIMIT 100;
          BEGIN
             FORALL i IN 1 .. data.COUNT
             SAVE EXCEPTIONS
                INSERT INTO my_new_objects
                VALUES data (i);
          EXCEPTION
             WHEN dml_errors
             THEN
                errors        := sql%BULK_EXCEPTIONS.COUNT;
                error_count   := error_count + errors;
                FOR i IN 1 .. errors
                LOOP
                   DBMS_OUTPUT.put_line(   'Error occurred during iteration '
                                        || sql%BULK_EXCEPTIONS(i).ERROR_INDEX
                                        || ' Oracle error is '
                                        || sql%BULK_EXCEPTIONS(i).ERROR_CODE);
                END LOOP;
          END;
          EXIT WHEN c%NOTFOUND;
       END LOOP;
       CLOSE mycur;
       DBMS_OUTPUT.put_line (error_count || ' total errors');
    END;Regards
    OrionNet

  • How to handle all UTF-8 char set in BizTalk?

    Can any one let me know how to handle UTF-8 char set in BizTalk.
    My receive file can contain any character set like ÿÑÜÜŒöäåüÖÄÅÜ . I have to support all char set under the umbrella of UTF-8.
    But when i am trying to convert flat file data to xml its converting special character to ??????????.
    Thanks,

    That won't work because the content has been modified simply by posting it.
    Let's start form the beginning:
    No component will ever replace any character with '?', that just doesn't happen.
    Some programs will display '?' if the byte value does not fall within the current character set, UTF-x, ANSI, ANSI+Code Page, etc.
    You need to open the file with an advanced text editor such as Notepad++. 
    Please tell us exactly where you are seeing the '?'.
    The Code Page is not an encoding itself, it is a special way of interpreting ANSI, single byte char values 0-254, in a way that supports characters beyond the traditional Extended Character Set.
    You need to be absolutely sure what encoding and possibly Code Page the source app is sending.  Notepad++ is pretty good at sniffing this out or just ask the sender.  If you determine that it's really UTF-8, you must leave
    the Code Page property blank.

  • How do I populate an array with a directory listing.

    I have a web site that has its photos updated by another person using a content management system that I have written. As Dreamweaver does not know about these extra photos, if I try to
    syncronise the site on my machine for backup purposes, Dreamweaver downloads all 5000+ photos, and this can take upwards of 12 hours if there are no breaks in the connection.
    So I am trying to write a page that creates an array of the existing files on the remote site. It will then do the same on my local site, and by comparing the arrays, will make a list of the new files, and then download these, which will save a lot of time and bandwith charges.
    First I have to read the directory list, using the code below which reads and echos it on screen.
    However, I cannot work out how to populate the required array.
    <?php
        try
        {          /***photo directory ***/
            $it = new directoryIterator('../web/thumbs');
            while( $it->valid())
                  /*** echo if not a dot directory ***/
                if( !$it->isDot() )
    /**** Array creation code needs to go here I think.***/
    echo $it->current()."<br />";
         /*** move to the next element ***/
                      $it->next();
        catch(Exception $e)
            /*** echo the error message ***/
            echo $e->getMessage();
    ?>
    This creates a list of files and displays it on the page.
    How do I store it in an array?
    Howard Walker

    Although not the solution you were looking for, consider the following:
    Click the icon in DW for "Expand to show local and remote sites."  Arrange the remote image directory by "Modified date," Then select all the recent images and GET them.
    I find the above method good enough for occassional synchronization. I also simply ignore broken image links on the testing system.
    If the above is not a solid enough solution, perhaps someone else will write your array function for you. I don't have the time.

  • How to handle multiple save exceptions (Bulk Collect)

    Hi
    How to handle Multiple Save exceptions? Is it possible to rollback to first deletion(of child table) took place in the procedure.
    There are 3 tables
    txn_header_interface(Grand Parent)
    orders(parent)
    order_items (Child)
    One transaction can have one or multiple orders in it.
    and one orders can have one or multiple order_items in it.
    We need to delete the data from child table first then its parent and then from the grand parent table.if some error occurs anywhere I need to rollback to child record deletion. Since there is flag in child table which tells us when to delete data from database.
    Is it possible to give name to Save exceptions?
    e.g.
    FORALL i IN ABC.FIRST..ABC.LAST SAVE EXCEPTIONS A
    FORALL i IN abc.FIRST..ABC.LAST SAVE EXCEPTIONS B
    if some error occurs then
    ROLLBACK A; OR ROLLBACK B;
    Please find the procedure attached
    How to handle the errors with Save exception and rollback upto child table deletion.
    CREATE OR REPLACE
    PROCEDURE DELETE_CONFIRMED_DATA IS
    TYPE TXN_HDR_INFC_ID IS TABLE OF TXN_HEADER_INTERFACE.ID%TYPE;
    TXN_HDR_INFC_ID_ARRAY TXN_HDR_INFC_ID;
    ERROR_COUNT NUMBER;
    BULK_ERRORS EXCEPTION;
    PRAGMA exception_init(bulk_errors, -24381);
    BEGIN
    SELECT THI.ID BULK COLLECT
    INTO TXN_HDR_INFC_ID_ARRAY
    FROM TXN_HEADER_INTERFACE THI,ORDERS OS,ORDER_ITEMS OI
    WHERE THI.ID = OS.TXN_HDR_INFC_ID
    AND OS.ID = OI.ORDERS_ID
    AND OI.POSTING_ITEM_ID = VPI.ID
    OI.DW_STATUS_FLAG =4 --data is moved to Datawarehouse
    MINUS
    (SELECT THI.ID FROM TXN_HEADER_INTERFACE THI,ORDERS OS,ORDER_ITEMS OI
    WHERE THI.ID = OS.TXN_HDR_INFC_ID
    AND OS.ID = OI.ORDERS_ID
    OI.DW_STATUS_FLAG !=4);
    IF SQL%NOTFOUND
    THEN
    EXIT;
    END IF;
    FORALL i IN TXN_HDR_INFC_ID_ARRAY.FIRST..TXN_HDR_INFC_ID_ARRAY.LAST SAVE
    EXCEPTIONS
    DELETE FROM ORDER_ITEMS OI
    WHERE OI.ID IN (SELECT OI.ID FROM ORDER_ITEMS OI,ORDERS
    OS,TXN_HEADER_INTERFACE THI
    WHERE OS.ID = OI.ORDERS_ID
    AND OS.TXN_HDR_INFC_ID = THI.ID
    AND THI.ID = TXN_HDR_INFC_ID_ARRAY(i));
    FORALL i IN TXN_HDR_INFC_ID_ARRAY.FIRST..TXN_HDR_INFC_ID_ARRAY.LAST SAVE
    EXCEPTIONS
    DELETE FROM ORDERS OS
    WHERE OS.ID IN (SELECT OS.ID FROM ORDERS OS,TXN_HEADER_INTERFACE THI
    WHERE OS.TXN_HDR_INFC_ID = THI.ID
    AND THI.ID = TXN_HDR_INFC_ID_ARRAY(i));
    FORALL i IN TXN_HDR_INFC_ID_ARRAY.FIRST..TXN_HDR_INFC_ID_ARRAY.LAST SAVE
    EXCEPTIONS
    DELETE FROM TXN_HEADER_INTERFACE THI
    WHERE THI.ID = TXN_HDR_INFC_ID_ARRAY(i);
    COMMIT;
    DBMS_OUTPUT.PUT_LINE(TO_CHAR(SYSDATE, 'DD-MON-YY HH:MIPM')||':
    DELETE_CONFIRMED_DATA: INFO:DELETION SUCCESSFUL');
    EXCEPTION
    WHEN OTHERS THEN
    ERROR_COUNT := SQL%BULK_EXCEPTIONS.COUNT;
    DBMS_OUTPUT.PUT_LINE(TO_CHAR(SYSDATE, 'DD-MON-YY HH:MIPM')||':
    DELETE_CONFIRMED_DATA: ERROR:Number of errors is ' ||ERROR_COUNT);
    FOR indx IN 1..ERROR_COUNT LOOP
    DBMS_OUTPUT.PUT_LINE('Error ' || indx || 'occurred during
    '||'iteration'||SQL%BULK_EXCEPTIONS(indx).ERROR_INDEX);
    DBMS_OUTPUT.PUT_LINE('Error is '
    ||SQLERRM(-SQL%BULK_EXCEPTIONS(indx).ERROR_CODE));
    END LOOP;
    END DELETE_CONFIRMED_DATA;
    Any suggestion would be of great help.
    Thanks in advance
    Anu

    If you have one or two places in your code that need multiple exceptions, just do it with multiple catch statements. Unless you are trying to write the most compact Programming 101 homework program, inventing tricks to remove two lines of code is not good use of your time.
    If you have multiple catches all over your code it could be a code smell. You may have too much stuff happening inside one try statement. It becomes hard to know what method call throws one of those exceptions, and you end up handling an exception from some else piece of code than what you intended. E.g. you mention NumberFormatException -- only process one user input inside that try/catch so it is easy to see what error message is given if that particular input is gunk. The next step of processing goes inside its own try/catch.
    In my case, the ArrayIndexOutOfBoundsException and
    NumberFormatException should be handled by the same way.Why?
    I don't think I have ever seen an ArrayIndexOutOfBoundsException that didn't indicate a bug in the code. Instead of an AIOOBE perhaps there should be an if statement somewhere that prevents it, or the algorithm logic should prevent it automatically.

Maybe you are looking for

  • Some iMessages go to my iPad only. Once in a while only.

    Sometimes iMessages go only to my iPad and not my cell. I checked my settings and "I can be reached by iMessage at" is set for the same number on both devices. Once I text back on the iPad, the rest of the communication shows up,on my cell. This happ

  • I put my iPad 2 to update (i forget which one) and it won't turn back on, it's been 2 days

    I put my ipad2 to update ( i forget which update) and now it won't turn back on

  • Calendar stuck in Spanish on my iPhone 4S

    Hi everyone! When I first got my iPhone 4S, I set the language to Spanish. After a while, I decided to change it to English. Everything changed, except the calendar and the weather app. My phone says today is jueves, 12 de deciembre and all of the da

  • Sharing Video - BBM or Text must be addressed

    Long time user.  Very happy with the new phone and software. I would like to make a suggestion.  As a loyal BB user and fan, I get frustrated when another device can do something my BB cannot....something that makes sense and is needed (I don't care

  • Arial Narrow missing CS5 with Win 7

    I found some threads related to this issue but all are related to Win XP.  These "solutions" also seem to require that you be a computer programmer to follow them Just got a new computer with Win 7 64-bit and just updated to Photoshop/Illustrator CS5