sort numbers separated by a comma in a table

The attached VI should accept two numbers, separated by commas, and then use the first number to set a Boolean value in a table. Then the next number must set the corresponding location of the array with the value.

For example, for a table of 5 elements:

User input is 3, 2. The VI will produce the following two tables:

F 0

F 0

T 2

F 0

F 0


Tags: NI Software

Similar Questions

  • Value separated by commas in a table column to get each field separtely?

    Hello

    I have the table that a column has values separated by commas in it. This table is populated using SQL LOADER, which is staging table.

    I need to retrieve the records of these values separated by commas.

    format of. CSV file is as -

    A separate file of pipes.

    DHCP-1-1-1. WNLB-CMTS-01-1,WNLB-CMTS-02-2|

    DHCP-1-1-2. WNLB-CMTS-03-3,WNLB-CMTS-04-4,WNLB-CMTS-05-5|

    DHCP-1-1-3. WNLB-CMTS-01-1.

    DHCP-1-1-4. WNLB-CMTS-05-8,WNLB-CMTS-05-6,WNLB-CMTS-05-0,WNLB-CMTS-03-3|

    DHCP-1-1-5 | WNLB-CMTS-02-2,WNLB-CMTS-04-4,WNLB-CMTS-05-7|

    CREATE TABLE link_data (dhcp_token VARCHAR2 (30), cmts_to_add VARCHAR2 (200), cmts_to_remove VARCHAR2 (200));

    insert into link_data values ('dhcp-1-1-1','wnlb-cmts-01-1,wnlb-cmts-02-2',null);

    insert into link_data values ('dhcp-1-1-2','wnlb-cmts-03-3,wnlb-cmts-04-4,wnlb-cmts-05-5',null);

    insert into link_data values ('dhcp-1-1-3','wnlb-cmts-01-1',null);

    insert into link_data values ('dhcp-1-1-4','wnlb-cmts-05-8,wnlb-cmts-05-6,wnlb-cmts-05-0,wnlb-cmts-03-3',null);

    insert into link_data values ('dhcp-1-1-5','wnlb-cmts-02-2,wnlb-cmts-04-4,wnlb-cmts-05-7',null);

    Here the cmts_to_add column has comma separted

    I need values such as -.

    > for wnlb-cmts-01-1,wnlb-cmts-02-2 > > wnlb-CMTS-01-1

    > > wnlb-CMTS-02-2

    > for wnlb-cmts-03-3,wnlb-cmts-04-4,wnlb-cmts-05-5 > > wnlb-CMTS-03-3

    > > wnlb-CMTS-04-4

    > > wnlb-CMTS-05-5

    And so on...

    I do this because it's the staging table and I load data into the main tables using this table.

    This second field contain different values as the simple comma-delimited string.

    I need to write a PLSQL block to insert into the main table after checking as if dhcp-1-1-1 and wnlb-CMTS-01-1 is present in the main table so not to introduce other insert a new record.

    To meet this requirement, I need to get the distinct value of the cmts_to_add column to insert into DB.

    the value will be inserted as dhcp-1-1-1_TO_wnlb-cmts-01-1 and dhcp-1-1-1_TO_wnlb-cmts-02-2 for the first row of the array of link_data.

    The process will also be same for the rest of the lines.

    I use the function substrt and instr for this problem, but its does not work.

    declare

    cursor c_link is select * from link_data.

    l_rec_link link_data % rowtype;

    l_dhcp varchar2 (30);

    l_cmts varchar2 (20000);

    l_cmts_1 varchar2 (32000);

    Start

    Open c_link;

    loop

    extract the c_link in l_rec_link;

    l_cmts: = l_rec_link.cmts_to_add;

    loop

    l_cmts_1: = substr (l_cmts, 1, instr(l_cmts,',')-1);

    dbms_output.put_line (l_cmts_1);

    end loop;

    dbms_output.put_line(l_dhcp||) e '|| l_cmts);

    When the output c_link % notfound;

    end loop;

    exception

    while others then

    Dbms_output.put_line ('ERROR' |) SQLERRM);

    end;

    Its a peusdo code I write, but it also gives me the wrong answer it gives me error ORA-20000: ORU-10027: buffer overflow, limit of 20000 bytes

    I am using-

    Oracle Database 11 g Enterprise Edition Release 11.2.0.1.0 - 64 bit Production

    Please tell me if my problem isn't clear!

    Hello

    little 'trick': Add a comma at the end of the chain... So it's easier to deal with the fact that there are zero, one, or N components...

    CREATE TABLE link_data (dhcp_token VARCHAR2 (30), cmts_to_add VARCHAR2 (200), cmts_to_remove VARCHAR2 (200));
    insert into link_data values ('dhcp-1-1-1','wnlb-cmts-01-1,wnlb-cmts-02-2',null);
    insert into link_data values ('dhcp-1-1-2','wnlb-cmts-03-3,wnlb-cmts-04-4,wnlb-cmts-05-5',null);
    insert into link_data values ('dhcp-1-1-3','wnlb-cmts-01-1',null);
    insert into link_data values ('dhcp-1-1-4','wnlb-cmts-05-8,wnlb-cmts-05-6,wnlb-cmts-05-0,wnlb-cmts-03-3',null);
    insert into link_data values ('dhcp-1-1-5','wnlb-cmts-02-2,wnlb-cmts-04-4,wnlb-cmts-05-7',null);
    COMMIT;

    SET SERVEROUT ON
    DECLARE
    l_cmts VARCHAR2 (200 CHAR);
    l_cmts_1 VARCHAR2 (200 CHAR);
    BEGIN
    FOR r IN (SELECT dhcp_token, cmts_to_add |) ',' cmts
    OF link_data
    )
    LOOP
    l_cmts: = r.cmts;
    l_cmts_1: = SUBSTR (l_cmts, 1, INSTR (l_cmts, ",") - 1);
    While l_cmts_1 IS NOT NULL
    LOOP
    DBMS_OUTPUT. Put_line (r.dhcp_token |) '|' || l_cmts_1);
    l_cmts: = SUBSTR (l_cmts, INSTR (l_cmts, ",") + 1);
    l_cmts_1: = SUBSTR (l_cmts, 1, INSTR (l_cmts, ",") - 1);
    END LOOP;
    END LOOP;
    END;
    /
    DHCP-1-1-1. WNLB-CMTS-01-1
    DHCP-1-1-1. WNLB-CMTS-02-2
    DHCP-1-1-2. WNLB-CMTS-03-3
    DHCP-1-1-2. WNLB-CMTS-04-4
    DHCP-1-1-2. WNLB-CMTS-05-5
    DHCP-1-1-3. WNLB-CMTS-01-1
    DHCP-1-1-4. WNLB-CMTS-05-8
    DHCP-1-1-4. WNLB-CMTS-05-6
    DHCP-1-1-4. WNLB-CMTS-05-0
    DHCP-1-1-4. WNLB-CMTS-03-3
    DHCP-1-1-5 | WNLB-CMTS-02-2
    DHCP-1-1-5 | WNLB-CMTS-04-4
    DHCP-1-1-5 | WNLB-CMTS-05-7

    Best regards

    Bruno Vroman.

  • regular expressions for numbers demical in a comma-delimited list


    I have a table that lists the details of the occupation of the sites of a comma-delimited list:

    create table tenure_test)
    number of site_number
    tenure_detail varchar2 (255));

    insert into tenure_test values (1, ' Crown (Other) (0.15 ha), private (555.25 ha)');
    insert into tenure_test values (2, ' private (5.76 ha)');
    insert into tenure_test values (3, ' private (0.18 ha, Crown (3.25 hectares), Indeterminate (Leased) (5.85 ha)');)

    What I want to do is to use a regular expression to calculate the sum only numbers in the tenure_detail column.

    For example, for site_number 1, it would be 0.15 + 555.25 = 555,4

    I also have another regular expression that has just the numbers in a comma-delimited list.

    For site_number 1: 0.15, 555.25

    I tried this:

    Select site_number, tenure_detail, regexp_substr (tenure_detail, "[0-9] + \.") ([0-9] {2}') under the name test1

    of tenure_test;

    but it lists only the first number.

    Hello

    996454 wrote:

    I have a table that lists the details of the occupation of the sites of a comma-delimited list:

    create table tenure_test)
    number of site_number
    tenure_detail varchar2 (255));

    insert into tenure_test values (1, ' Crown (Other) (0.15 ha), private (555.25 ha)');
    insert into tenure_test values (2, ' private (5.76 ha)');
    insert into tenure_test values (3, ' private (0.18 ha, Crown (3.25 hectares), Indeterminate (Leased) (5.85 ha)');)

    What I want to do is to use a regular expression to calculate the sum only numbers in the tenure_detail column.

    For example, for site_number 1, it would be 0.15 + 555.25 = 555,4

    I also have another regular expression that has just the numbers in a comma-delimited list.

    For site_number 1: 0.15, 555.25

    I tried this:

    Select site_number, tenure_detail, regexp_substr (tenure_detail, "[0-9] + \.") ([0-9] {2}') under the name test1

    of tenure_test;

    but it lists only the first number.

    Here's one way:

    SELECT site_number

    SUM (TO_NUMBER (REGEXP_SUBSTR (tenure_detail

    , "\d+\.\d*" - see Note 1

    ) T

    LEVEL

    )

    )

    ), Total

    OF tenure_test

    CONNECT BY LEVEL<= regexp_count="" (="">

    , '\d+\.\d*'

    )

    AND PRIOR site_number = site_number

    AND PRIOR SYS_GUID () IS NOT NULL

    GROUP BY site_number

    ;

    Output:

    TOTAL OF SITE_NUMBER

    ----------- ----------

    1 555,4

    2 5.76

    3 9.28

    Note 1: what exactly makes a 'number '?  I'm assuming it's 1 or more digits, followed by a comma, followed by 0 or more numbers.  You can have a slightly different definition; in this case, change the arguments 2nd REGEXP_SUBSTR and REGEXP_COUNT.

    I guess also that site_number is unique.  If not, you will have to change the CONNECT BY and GROUP BY clauses, to refer to something (or a combination of things) which is unique.

    Relational databases are designed for each column of each row contain 1 single piece of information, not a list delimited with a variable number of elements.  It is so basic to the design of database he called the first normal form.  If your first followed table form normal, this query (and many other queries that involve that table) would be much simpler to write, more efficient to run and less likely to have bugs.  See if you can normalize this table.  Any effort that you have to spend now to normalize the table will pay very quickly.

    Thanks for posting the CREATE TABLE and INSERT statements; It is very useful.

    Don't forget to tell what version of Oracle you are using.  I tried the query in Oracle 11.2 above.  You may need to CONNECT BY a little differently in earlier versions, and REGEXP_COUNT will not work in Oracle 10.

  • Values separated by using commas as separate dimensions

    Hi all

    We use text files as a data source for the update of database short. We add 4-5 properties in the text file. Each property has values separated by commas for example property name of category a category 1, Category2, category3... category10 values. I defined a dimension of my workbench short mapping the category property of the dimension short text file in the Workbench. But I want to than each of the categories to be dealt with as separate dimension for example values * "Category1" *, * "Category2" *... * "category10" * for the size of the category and not only ' * Category1, Category2,... category10 "* as value a single dimension. Anyone have any idea how to do it?

    Published by: user8540737 on June 26, 2012 13:49

    Thanks for your question.

    Your use case of reading in a list of values basket and want to these values be separated and mapped in one Dimension is very common.

    In your pipeline of short Developer Studio, you can easily add a new Record manipulator which fills a SPLIT to accomplish this function you need.

    You can learn more about the creation of a manipulator for registration in the [Developer Studio Help Guide | http://docs.oracle.com/cd/E28912_01/DeveloperStudio.612/pdf/DevStudioHelp.pdf]. You can also learn more about the syntax to create a SPLIT function in the [Expression Data Foundry Guide | http://docs.oracle.com/cd/E28912_01/DeveloperStudio.612/pdf/DataFoundryExpRef.pdf].

    For more convenience, a syntax example...






  • Ask them help - string as columns separated by a comma

    Hello
    My requirement is

    The following string is a comma-separated string

    '389052,100207'

    The string above is divided into 2 and appears as in 2 columns
    SELECT substr ('389052,100207' ,1,6) , substr ('389052,100207' ,8,12) from dual     
    Instead of writing above how can I achieve this

    Thank you
    SQL> with t as (select '389052,100207' str from dual)
      2  select  substr(str,1,instr(str,',') - 1) part1,
      3          substr(str,instr(str,',') + 1) part2
      4    from  t
      5  /
    
    PART1  PART2
    ------ ------
    389052 100207
    

    Or:

    SQL> with t as (select '389052,100207' str from dual)
      2  select  regexp_substr(str,'^[^,]+') part1,
      3          regexp_substr(str,'[^,]+$') part2
      4    from  t
      5  /
    
    PART1  PART2
    ------ ------
    389052 100207
    
    SQL> 
    

    SY.

  • Select decimal between numbers and replace with comma - style Grep

    H,

    Could someone please help with some Grep expressions.

    I have a big document (s) I need to locate all decimals between numbers and replace them with commas. I have a little grep expression that can locate the numbers and a decimal number, but I need to follow the numbers once again, as I am also find figures at the end of a sentence:

    To find:

    22.356

    so far:

    \d+(?=\.)

    replace:

    \d+(?=\,)

    Lister

    This should work for you

    To find

    (\d+)\. (\d+)

    Replace

    $1, $2

    That there are numbers with a period between them. The expression of replacement will replace your numbers by themselves and the period with a comma. Because the search expression is looking for numbers on both sides of your period, it will leave the ends of sentences only.

  • How to: Sort numbers in ascending in a generated list order

    Greetings! How can I set up a list of paragraphs generated so that it sorts in ascending order of true? What I want is:

    1.1

    1.2

    1.3

    1.4

    1.5

    1.6

    1.7

    1.8

    1.9

    1.10

    I tried all the stuff I can think with the listed on the reference page sort order. But all I can get something that sorts by individual number (without taking into account the numerical value) as:

    1.1

    1.10

    1.11

    1.2

    1.20

    1.21

    1.3

    Any help is very appreciated!

    TMS,

    To me it looks like hand-numbering of requirements using a method that allows a correct alphabetical sorting, e.g. 01, 02, if you do not expect more than 99 titles.

    For the moment, I don't know better.

    -Michael

  • Correct sort numbers stored as text

    I have a few numbers of documents stored as text values that I want to sort in the correct order. However, what I get is 1-101, 1 - 10A, 1-11, 1-14, 1-17, 1 - 17A .i, 1-19, 1-2, 1-21, 1-30, 1.35, 1.47, 1-4-A, 1-5, 1-7, 1 - A, 1 B, 1 - C. This is the title of the document ID, that is why the inconsistancy. I wish they would have done better with it, but these docs old ar and and all I have to work with. It is just a small set. I have a lot more starting with 2, 3 and so on.

    I was wondering how can I get these to be sorted in the correct order of smallet to the largest. I.E.
    1-2, 1-4-A, 1-5, 1-7, 1-10, 1-11, 1-14, 1 - 17A, 1 - 17A .i, 1-19, 1-21, 1-30, 1.35, 1.47, 101, 1-1-A, 1 B, 1 c

    The ABC may be at the beginning or at the end is okay as long as the figures are correct.

    Is this possible. Thanks for the help.

    It is stored in a MS Access database. I think I knew how to do things in the right order. Since there is an inconsistancy in the naming convention, I came a way to make it consistent. I have 2 columns, 1 with the document ID number and one with just the number of the document (1-17 has 17 for the second column). This way I can fool all initially based on the second column as they are entirely digital and so for the first column of I duplicated in the second column.

    For example, 1 - 17A and 1-17A .i have all two 17 in the second column, but by sorting two columns, the order is correct and 1 - 17A comes before 1-17A .i. For document ID's that do not have a number and a letter such ast 1A, I assing a certain number of 1000A, 1001 for B and so on. In this way they have a number too and will usually appear at the end of the list.

  • Values separated by a nested as comma from string table

    I would insert the contents of a table nested in the form of comma-separated values in a string.


    For example, I created:

    CREATE TYPE u_results AS TABLE OF VARCHAR2 (10);
    /

    CREATE TABLE example_table)
    number of obj_id,
    obj_results u_results)
    NESTED TABLE obj_results STORE AS obj_results_t;

    INSERT INTO example_table (obj_id, obj_results) VALUES (1, u_results ('OK', 'NOK', 'NN'));
    INSERT INTO example_table (obj_id, obj_results) VALUES (2, u_results ('OK', 'NOK'));

    CREATE TABLE example_table2)
    number of obj_id,
    obj_results2 VARCHAR2 (100));

    So, in the example_table2 table I would have obj_results values in obj_results2 as string separated by commas.

    for example
    OBJ_ID obj_results2
    1 OK, NOK, NN
    2 OK, NOK

    Any ideas? Thank you
    G.
    SQL>  create type u_results as table of varchar2 (10);
    /
    Type created.
    
    SQL>  select rtrim (xmlagg (xmlelement (e, column_value || ',')).extract ('//text()'), ',') csv
          from table (u_results ('AA', 'BB')) t
    /
    CSV
    ----------
    AA,BB
    1 row selected.
    
    SQL>  drop type u_results
    /
    Type dropped.
    
  • Problem using the list separated by commas with nested table element

    Hello

    I have a list separated by commas like this:
    H23004,H24005,T7231,T8231,T9231
    And want to create a function that creates a where clause clause for each element with an output like this:
    UPPER('H23004') IN (UPPER(charge))
    OR UPPER('H23005') IN (UPPER(charge))
    OR UPPER('T7231') IN (UPPER(charge))
    OR UPPER('T8231') IN (UPPER(charge))
    OR UPPER('T9231') IN (UPPER(charge))
    Here's my test function that is not working properly:
    create or replace function FNC_LIST_TO_WHERE_CLAUSE(v_list in VARCHAR2) return varchar2 is
     -- declaration of list type
     TYPE batch_type IS TABLE OF pr_stamm.charge%TYPE;
     -- variable for Batches
     v_batch batch_type := batch_type('''' || replace(v_list,',',''',''') || '''');
     return_script varchar2(1000);
    
     BEGIN
     -- loop as long as there are objects left
     FOR i IN v_batch.FIRST .. v_batch.LAST
     LOOP
       --DBMS_OUTPUT.PUT_LINE(offices(i));
       -- create where clause
       IF i = 1 THEN
         return_script := 'UPPER(' || v_batch(i) || ') IN (UPPER(charge))';
       ELSE
         return_script := return_script || ' OR UPPER(' || v_batch(i) || ') IN (UPPER(charge))';
       END IF;
     END LOOP;
    
     return (return_script);
     end;
    The out put looks like this:
    UPPER('H23004','H24005','T7231','T8231','T9231') IN (UPPER(charge))
    I don't know what I did wrong? It calculates the amount of the incorrect array element! (v_batch. Must be 5)
    v_batch. FIRST = 1
    v_batch. LAST = 1

    Kind regards

    Tobias

    Try this...

    declare
    text varchar2 (1000): = "H23004, H24005, T7231, T8231, T9231;
    v_where varchar2 (1000);
    Start
    Text: = text | «, » ;
    While instr (text, ',') <> 0
    loop
    v_where: = v_where | ' UPPER ("': substr (Text, 1, InStr(Text,',',1)-1) |") ' IN (UPPER (load)) OR ';
    text: = substr (text, instr(text,',',1) + 1);
    end loop;
    v_where: = substr (v_where, 1, length (v_where)-3);
    dbms_output.put_line (v_where);
    end;

    convert it to function...

  • Capacity of sorting numbers Macbook Pro (mid-2009; OS10.11.6; 3.6.2 numbers

    I searched, but couldn't find an answer to: -.

    If I added a sort column and then how to remove one or more of the rows/columns selected in the sorting - or even simply reset my sort options?

    I see that I can cancel a kind up to a limit, but not how to edit that I need.

    to remove a column, select the column and then click the arrow on the bottom to ("'-/ '") that appears when you hover over the column header:

    Then select the menu item "Delete column".

  • sorting AdvancedDataGrid separator

    The kind of ADG separator is always visible, even though I turned it off sortablecolumns. How can I go on hiding of this give more with the text in the header? Some of my articles are only 40px wide but the way separator takes most of this place to hide the label.



    I guess your question is identical:
    http://bugs.Adobe.com/jira/browse/FLEXDMV-1243
    It would be available in the next beta release.

  • can I use: separation by a comma to compare the values with another table

    Hi ALL, I am using oracle 10g, can someone help me with this query
    WITH t AS
         (SELECT 20 ID, 'ABC,DEF,GHI' VALUE
            FROM DUAL),
         x AS
         (SELECT 20 ID, 'ABC' VALUE
            FROM DUAL
          UNION ALL
          SELECT 20, 'DEF'
            FROM DUAL
          UNION ALL
          SELECT 20, 'GHI'
            FROM DUAL)
    SELECT x.ID, x.VALUE
      FROM x, t
     WHERE x.VALUE IN (t.value);
    
    o/p required
    -------------------
    20  ABC
    20  DEF
    20 GHI
    I know I can't use t.valeur in TO would adopt. so I tried to use it in the paragraph, but it did not work.
    ''''|| Replace (T.valeur, ",", "", "') |" '

    Published by: DeepakDevarapalli on December 15, 2009 19:27

    Hello

    Here's a way to do it:

    SELECT      x.ID
    ,      x.VALUE
    FROM      x
    JOIN     t     ON      ',' || t.value || ','
              LIKE     '%,' || x.value || ',%'
    ;
    

    Extra commas are necessary to avoid the problem of 'mother is in chemotherapy,' when a single value can be one substring of another. If this is impossible (as in your case, where all values are exactly 3 characters) then you don't have them.

  • Number of numbers separated from practice quiz on "Number of Questions"

    I have a program that has a practice (4 questions) and a final quiz (25 questions). They have been developed both slides in question, but I would like to only the section final quiz score report. I put question 4 in the practice section to score 0 and unaware, but before the end of the final quiz, the total number of questions shows that 29 (25 + 4 quiz practices).

    I so create a false text box saying "many Questions: 25" to fool users, but I can't ask that even cheat solution to the "correct Questions. The number is not editable through JavaScript files in the SCORM package...

    A similar question was posted here a year ago with no solution to it. I wonder if something has changed since then and if anyone knows how to solve this problem.

    Here is a picture of my screen with the fake text box saying total issue is 25. The score is again properly (4 points each and with 24 correct on 25, gets the user 96 points). But the correct questions showed that 28 of the 29 (25 + 4).

    1.jpg

    Thank you!

    Hello

    There is no way to change the system variables such as the number of questions. If you, like me, it would be really interesting to have such a control fill a feature request (did ask about it already myself).

    For now, the only solution I see and use myself, creates no-to-be-scored questions using standard and interactive objects and advanced actions (e.g. to show your comments). Because these issues do not have to be striped or reported, Quiz system variables will then contain the good values for the final Quiz created with Question slides. If you want to view results, the 'partition' slide may also be created with these objects and advanced actions.

    The thread, you said it, was also for CP4, nothing has changed since. And I'm sorry, but also in the soon that will be launched in the next version (CP5) there is no way to change the system of variable Quiz AFAIK.

    Lilybiri

  • NUMBER MUST BE SEPARATED BY A COMMA

    Hello
    I wish the number to display in decimal
    I tried with the following code, but I get the following error as
      1* SELECT TO_CHAR(123456123.122234,'FM999,999,999D99')  FROM DUAL
    SQL> /
    SELECT TO_CHAR(123456123.122234,'FM999,999,999D99')  FROM DUAL
                                    *
    ERROR at line 1:
    ORA-01481: invalid number format model
    How to solve this problem...

    Try:

    Select double to_char(123456123.122234,'fm999g999g999d99');

Maybe you are looking for

  • "error 9" all solutions

    If anyone has other solutions that connect my iPhone via USB to the computer please let me know. I just completely updated but my phone still mess up when I try to restore and update.

  • DataFileExport

    Hello I face a problem with the order of DIAdem DataFileExport. Indeed, I would like to export one or more channels from the portal of data in an Excel file. I followed the help and wrote this very simple code: Call DataFileExport ("C:\Documents and

  • How to configure a router modem

    Comment know ke my modem is set up in router mode knowing c UN modem cable pay to be able to watch TV.

  • DateBk6p and Motion Apps classic Question?

    Anyone using Datek6p on their Palm Pre with the Classic emulator?  How does it work?  You can synchronize the data anywhere? Previous calendar and tasks PalmOS lists were not perfect, but very usable, and fairly customizable.  I upgraded using DateBk

  • All-in-one: how to analyze when the printer is broken?

    Hello. I have a HP 4480 all-in-one, and the printer stopped working earlier. I think it's really broken, the print heads seem to be stuck. Well, I don't really mind, I have an older printer that does work, but the scanner no longer works, asking the