How better to insert a subarray (line) in a 2D array to the correct index which is based on the value of the first column

Hello

I would like to insert a subarray (line) in a 2D to the correct index table. The position is to say the index value depends on the value of the first column of the table 2d.

As an examlple my 2d array would look like this

230 50 215 255

300 60 270 330

360 20 350 370

And I would like to insert another line (subarray) with the following values

320 40 300 340

This new line should be placed between the second and third rows (this is based on the first column only).

I tried the threshold 1 d function table by taking an 1Dsub array of my 2d array (first column), then using the first of the new line (320) as the threshold. It sort of work, but it does not work when I start the table (IE there is only 1 row) and it seems to not work properly on other occasions (as explained in the help of Labview).

Hopefully the explanation is clear enough for any suggestion. Thanks in advance for the help!

JTRI wrote:

The idea is I have start with a new table and add these lines in the right order every time that the user sets the values Jack

Ahh, so try this.

This will also work with an empty array.

You want to do with this function it is a Subvi.

Make the entries 'table' and 'subarray"on the connector, then 'new array' output.

You can then put this Subvi in a loop with a registry to shift and it will help to add new lines in a sorted order, when they are added.

That is what you were aiming for?

Tags: NI Software

Similar Questions

  • How to apply a net of InDesign paragraph above, but not when the first column

    How to do a paragraph rule 'above' but not when it is first in a column. In other words, the rule above will work only if it is not the first paragraph of the column (even if it appears in a block of text in multiple columns).

    Before jump you the gun: rule below will not solve that, for various reasons.

    Thank you very much in advance.

    I'm not completely fluent in JS, but I think it should work:

    main();

    main() {} function

    all the stories

    for (var i = 0; i)< app.activedocument.stories.length;="">

    monarticle var = app.activeDocument.stories.item (i);

    text of history columns

    for (var j = 0; j)

    var c = myStory.textColumns.item (j);

    first line in a column

    var b1 = c.lines [0];

    first line in the first paragraph of the column

    var b2 = c.paragraphs [0] .lines [0];

    disable the rule if they are equal

    If (b1.baseline == b2.baseline) {}

    {if (c.appliedParagraphStyle.ruleAbove)}

    c.paragraphs [0] .ruleAbove = false

    }

    }

    else {}

    c.paragraphs [0] .ruleAbove = true

    }

    }

    }

    }

  • How remove the line by line by comparing to the first column?

    Hello!

    I have a problem - I need to remove the line by line, but the problem is, I know that the first COLUMN of the table is a PK.
    To retrieve the NAME of the COLUMN that I use:

    SELECT column_name, table_name FROM USER_TAB_COLUMNS WHERE column_id = 1 and table_name = c1.tmp_table_name;
    But it does not somehow.
    Below you can see my script (which has not worked for now):

    declare
    XXX varchar2 (100);
    Start
    C1 in (select table_name, tmp_tables tmp_table_name) loop
    IMMEDIATE EXECUTION
    ' SELECT column_name in ' | xxx | "USER_TAB_COLUMNS WHERE column_id = 1 AND table_name = ' |" ' || C1.tmp_table_name | " ' ;
    immediate execution
    "start."
    for c2 in (select * from ' | c1.tmp_table_name | start loop ')
    Insert into ' | C1.table_name | "values c2; delete from ' | C1.tmp_table_name | 'where ' | xxx |' = c2.' | xxx |'; exception: when other then null; end; end loop; end;';
    end loop;
    end;

    P.S. The Inserts work perfect. I have a problem with deleting lines that are in c1.table_name, of c1.tmp_table_name (the two tables have the same structure, PK, always), because I have the names of columns different another tables which are PK. (for example: K, ID, NS and so on) Please help me to write the correct script.
    For example this will be for the first line recovered as:
    Start
    C1 in (select table_name, tmp_tables tmp_table_name) loop
    immediate execution
    «Start for c2 in (select * from ' |)» C1.tmp_table_name | Start loop ')
    Insert into ' | C1.table_name | "values c2; delete from ' | C1.tmp_table_name: ' where K = c2. K; exception: when other then null; end; end loop; end;';
    end loop;
    end;
    This script works perfectly. But I have many other tables with different PK - K No.

    Solution with the logging of errors table

    -- create the error-logging table
    CREATE TABLE tbl_MergeErrors (
        Stamp       TIMESTAMP(3),
        TableName   VARCHAR2(30),
        KeyColumn   VARCHAR2(30),
        KeyValue    VARCHAR2(4000),
        ErrorCode   NUMBER(5),
        ErrorMsg    VARCHAR2(4000),
    
      CONSTRAINT pk_MergeErrors
          PRIMARY KEY (TableName, Stamp)
          USING INDEX
    )
    /
    
    -- procedure to insert errors
    CREATE OR REPLACE
    PROCEDURE LogMergeError (pTableName  IN VARCHAR2,
                             pKeyColumn  IN VARCHAR2,
                             pKeyValue   IN VARCHAR2)
    IS PRAGMA AUTONOMOUS_TRANSACTION;
    
        -- you couldn't insert SQLCODE or SQLERRM directly into a table (ORA-00984)
        nSQLCODE   NUMBER(5)      := SQLCODE;
        vcSQLERRM  VARCHAR2(4000) := SQLERRM;
    
    BEGIN
      INSERT INTO tbl_MergeErrors
             (Stamp, TableName, KeyColumn, KeyValue, ErrorCode, ErrorMsg)
          VALUES (SYSTIMESTAMP, RTrim( SubStr( pTableName, 1, 30)),
                  RTrim( SubStr( pKeyColumn, 1, 30)), SubStr( pKeyValue, 1, 4000),
                  nSQLCODE, vcSQLERRM);
      COMMIT WORK;
    
    -- if an error occured here, then just roll back the autonomous transaction
    EXCEPTION
      WHEN OTHERS THEN   ROLLBACK WORK;
    END LogMergeError;
    /
    
    -- create the tables and insert test-data
    CREATE TABLE TMP_TABLES (
        TABLE_NAME       VARCHAR2(200),
        TMP_TABLE_NAME   VARCHAR2(200),
      CONSTRAINT TMP_TABLES_X PRIMARY KEY (TABLE_NAME)
    )
    /
    CREATE TABLE TMP_KL002 (
        K   VARCHAR2(40),
        N   VARCHAR2(200)
    )
    /
    CREATE TABLE TMP_TABLE1 (
        NS   VARCHAR2(40),
        N    VARCHAR2(200)
    )
    /
    CREATE TABLE KL002 (
        K VARCHAR2(40),
        N VARCHAR2(200),
      CONSTRAINT PK_KL002 PRIMARY KEY (K)
    )
    /
    CREATE TABLE TABLE1 (
        NS   VARCHAR2(40),
        N    VARCHAR2(200),
      CONSTRAINT PK_TABLE1 PRIMARY KEY (NS)
    )
    / 
    
    INSERT INTO TMP_TABLES (TABLE_NAME, TMP_TABLE_NAME) VALUES ('kl002','tmp_kl002');
    INSERT INTO TMP_TABLES (TABLE_NAME, TMP_TABLE_NAME) VALUES ('table1','tmp_table1');
    INSERT INTO tmp_KL002 (K, N) VALUES ('00', 'none');
    INSERT INTO tmp_KL002 (K, N) VALUES ('07', 'exists');
    INSERT INTO tmp_KL002 (K, N) VALUES ('08', 'not assigned');
    INSERT INTO tmp_table1 (NS, N) VALUES ('2000', 'basic');
    INSERT INTO tmp_table1 (NS, N) VALUES ('3000', 'advanced');
    INSERT INTO tmp_table1 (NS, N) VALUES ('4000', 'custom');
    COMMIT WORK;
    
    -- to test, if it works correct when primary key values exists before
    INSERT INTO KL002 VALUES ('07', 'exists before');
    COMMIT WORK;
    
    -- check the data before execution
    SELECT * FROM TMP_KL002 ORDER BY K;
    SELECT * FROM KL002 ORDER BY K;
    SELECT * FROM TMP_TABLE1 ORDER BY NS;
    SELECT * FROM TABLE1 ORDER BY NS;
    
    -- empty the error-logging table
    TRUNCATE TABLE tbl_MergeErrors DROP STORAGE; 
    
    -- a solution
    DECLARE
    
        PLSQL_BLOCK  CONSTANT VARCHAR2(256) := '
    BEGIN
      FOR rec IN (SELECT * FROM <0>) LOOP
        BEGIN
          INSERT INTO <1> VALUES rec;
          DELETE FROM <0> t WHERE (t.<2> = rec.<2>);
        EXCEPTION
          WHEN OTHERS THEN
              LogMergeError( ''<1>'', ''<2>'', rec.<2>);
        END;
      END LOOP;
    END;';
    
    BEGIN
      FOR tabcol IN (SELECT t.Tmp_Table_Name, t.Table_Name, c.Column_Name
                     FROM Tmp_Tables t,
                          User_Tab_Columns c
                     WHERE     (c.Table_Name = Upper( t.Tmp_Table_Name))
                           AND (c.Column_ID = 1)
                ) LOOP
        EXECUTE IMMEDIATE Replace( Replace( Replace( PLSQL_BLOCK,
                                   '<0>', tabcol.Tmp_Table_Name),
                                   '<1>', tabcol.Table_Name),
                                   '<2>', tabcol.Column_Name);
      END LOOP;
    END;
    / 
    
    -- check the data after execution ...
    SELECT * FROM TMP_KL002 ORDER BY K;
    SELECT * FROM KL002 ORDER BY K;
    SELECT * FROM TMP_TABLE1 ORDER BY NS;
    SELECT * FROM TABLE1 ORDER BY NS;
    
    -- ... and also the error-logging table
    SELECT * FROM tbl_MergeErrors ORDER BY Stamp, TableName;
    
    -- of couse you must issue an COMMIT (the ROLLBACK is only for testing
    ROLLBACK WORK;
    
    -- drop the test-tables
    DROP TABLE TABLE1 PURGE;
    DROP TABLE KL002 PURGE;
    DROP TABLE TMP_TABLE1 PURGE;
    DROP TABLE TMP_KL002 PURGE;
    DROP TABLE TMP_TABLES PURGE;
    
    -- you shouldn't drop the error-logging table, but I use it to free up my db
    DROP TABLE tbl_MergeErrors PURGE;
    

    Greetings, Niels

  • How can I add a game action on an object that contains the first click and read reversed to this object even a second click action?

    How can I add a game action on an object that contains the first click and read reversed to this object even a second click action?

    First create a symbol of the object.

    Then add the code in the event click on this symbol as below:

    Insert the code for the mouse, click here

    var bReverse = (sym.getVariable ("reverseDir")! = undefined)? (sym.getVariable ("reverseDir")): true;

    sym.setVariable ("reverseDir", bReverse)

    {if (bReverse)}

    sym.playReverse ();

    }

    else {}

    SYM. Play();

    }

    HTH,

    Vivekuma

  • Columns of folder: by default, how can return the first column 'Name' without having to move it manually every time?

    Something's happened awhile and when I create a folder which appears the first column is the column 'Date modified '. By default, how can return the first column 'Name' without having to move it manually every time?

    Hello

    I suggest you to visit these links and check if it helps:

    http://Windows.Microsoft.com/en-us/Windows-Vista/working-with-files-and-folders#section_4

    http://Windows.Microsoft.com/en-us/Windows-Vista/folders-frequently-asked-questions

    It will be useful.

  • How to count the first column automatically.

    Dear all.

    I would like to calculate the first column from 1 to N, when the user clicks on the add a line button.

    Please refer to the following

    -------------------------------------- Code --------------------------------------

    var nNodes is Test_Result1.sub_Product_accessories. Config_Acc.resolveNodes ("Config_Acc [*]"). Length;


    If (nNodes < = 6) {}
    Test_Result1.sub_Product_accessories. Config_Acc.instanceManager.addInstance ();
    }

    AS-IS

    count.JPG

    AS IT WILL BE

    count2.JPG

    Javascript code the Initialize event of the AccNum field:

    this.rawValue = this.parent.index + 1

  • How can I insert a return line?

    I have an element of multi-line text in a form. How can I control when going to a new line? The text wraps to a new line, but I want to be able to insert a back line that says '' go now on a new line. ''

    Thank you

    Hello!
    You can use the Chr (10) for the next line.
    for example:

    :block.item := 'line 1' || chr(10) || 'line 2' );
    

    Concerning

  • How can I trap FRM-40102: Record must be entered or deleted the first error

    Whenever I click the box tool button insert record (green more) I get FRM-40102: Record must be entered or deleted the first error. How to catch the trap this error?

    IF errnum = 40102 THEN
    Clear_All;
    create_record;
    END IF;

    I want to put the above code. What trigger, I need to add this code. I have the multi block shape.

    Hi Chris,
    You can use the ON-ERROR trigger at the level of the form like that...

    IF ERROR_CODE=40102 THEN
     -- Do something here...
    ELSE
      MESSAGE(ERROR_TEXT);
      MESSAGE(ERROR_TEXT);
      RAISE FORM_TRIGGER_FAILURE;
    END IF;
    

    -Clément

  • How much time must be recharged Satellite Pro U200-10 b for the first time

    Hello

    How long the computer laptop Saturday Pro U200-10 b should there be for the first time?

    Kind regards
    CC

    Hi Christoph

    That s easy. You must charge the battery for laptops up to the battery LED switches to green light or blue. I put t know exactly the LED on the U200 Pro colors.

    A hint; all the details should be in the manual of the user who is always pre-installed on Toshiba laptops
    There, you will find also information about the battery and manipulation.

    Concerning

  • How to compare one by an element of a column with the first column in the other table?

    Hello

    I have two files into a single file has only Id numbers and the second file has table with for example the column 4, and his first column identification number.

    So I want to compare the first item in the User.ID file with the 1st column all the table file items in this column until it finds matches.

    If compare match then LED will be IT other wise LED will be OFF.

    Here as an attachment, I've attached the two file.

    Please guide me how can I do the same thing.

    Thank you much in advance.


  • How can I purchase a student plan? Failed to get through the first stage.

    I am buying a plan of the student, but I can't step hollow on what school I go and when I'm going to graduate. Fill in all the fields, but "keep it going" - button does not respond when I want to go to the next step. I have to do something wrong.

    I'm just the first field must be typed as "SchoolName, city", or must it be typed differently? This is the only field I can type it myself so I guess that's the problem?

    Hi Linnea,

    Please visit http://www.adobe.com/education/students/how-to-buy-eligibility.edu.html?

    For other queries, please join the sales of Adobe directly who can help you place the order.

    Kind regards

    Sheena

  • How can I insert C structures that have pointers to characters in the DBD file

    Hello ~

    I am changing to a file system, I did in DBD.

    And I had no other choice to convert structures that dot character members
    to insert them into the DBD file

    for the interpreter,.
    If there is a structure like below

    typedef struct
    {
    int IndexKey;
    groupID int;
    char * name;
    char * pNum;
    char * pAddr;
    char * pMemo;
    } TsomeRec;

    I did a structure to be converted as below

    typedef struct
    {
    int IndexKey;
    groupID int;
    name char [MAX_NAME_LEN];
    pNum tank [MAX_NUM_LEN];
    pAddr tank [MAX_ADDR_LEN];
    char pMemo [MAX_MEMO_LEN];
    } TsomeRec2;


    But there are too many structures to convert.

    So, I'm looking for the most effective way to integrate these records DBD structures, given Performance.

    Frankly speaking, I'am not competent.
    Please describe as accurate as possible.

    Thank you ~.

    Hello

    Review the section title documentation through Structures with DB C, in particular paragraph called C Structures with pointers. He will explain how to store structures with pointers.

    Kind regards
    Andrei

  • How to display a checkbox in the first column of the table?

    Hai
    I want to show a check box in a table in my jspx page... Consider that the table containing the fields: id, name, designation, salary... user.user is a hidden field... I drag the viewObject dataControl and select ADF table... The main objective of my table check box list is, I want to show more details in another table, when I check it (as I have wanted to show its location in another table in the jspx page, when I check the box)... and I only want to save the selected lines...

    Hello

    Open your VO.xml file and make sure your attribute of salt has Updatable. I tried with Updatable = 'Never' and the box is not selectable. On the other hand, he always affecting selected the check box.

    If this does not work, you will need to check the value binded to the box and the page definition file. Make sure that the attribute of salt is still in your definition of the Page file. Here is my sample code of my Jspx page that worked. After you create the table, I inserted a selectBooleanCheckbox into the column of salt (in collaboration with the existing inputText. Then I copied the bind to the checkbox value as it is in the inputText. You can then remove the inputText.

    
      
        
      
      
    
    

    Kind regards
    Amélie Chan

  • The folder with the question mark comes every day. I can connect by reselection of start-up, but how can I avoid this problem happening every day? I ran the first aid successfully. MacBook Air 2011, El Capitan 10.11.5

    Problem persists, every day. Able to bypass, but would love for the problem to occur. Problem when it's on battery or plugged in. A run first aid on the disc and has demonstrated no error.

    Try a SCM and reset NVRAM:

    https://support.Apple.com/en-us/HT201295

    https://support.Apple.com/en-us/HT204063

    This is a guess on my part, but no harm can come to your MBA by performing these.

    Ciao.

  • How I can add to a table of defined length and have the first value is the first value out.

    I want to build/adding a table. Let's say that the length is set to 10 items. When is element 11 I want the first element to be expelled for that table a always the latest 10 items in there in order. the berries should look like this:

    {0,1,2,3,4,5,6,7,8,9}

    1,2,3,4,5,6,7,8,9,10 {}

    {2,3,4,5,6,7,8,9,10,11}

    etc.

    Any help is greatly appreciated. Thank you

    Here's a VI revised, except that I use LV8.5 and the lowest, I can record down to is 8, so maybe someone will be kind enough to convert it?

    Attached an image too

Maybe you are looking for