How do I insert into an array only if the condition is true?

I am buiding an array made up of pairs of data from a file. I am going through line by line putting the values in an array and then taking the pairs of two indexes oring them and putting the number into another array. I do not know if there is more than one set on each line so I have to do a while loop to check.The problem is I have to get the indexes in pairs, so for example I take in the element from index 0 and 1 and or them index 2 and 3 and or them, I do not need the combination of 1 and 2 or 3 and 4 and etc. I am using the "Quotient & Remainder" to check if the index is even or odd, if it is even I take that element and the very next index's element, I or them and put them in another array, but if i
t is odd I do not want to put anything into the array. How can I go about doing that? Any help would be appreciated. I am using version 6.1 Thanks, Molly
Attachments:
labview.bmp ‏3841 KB

Molly,
Rather than running while loop which only executes code every other time you could instead just do a little more math to get your index values. Just multiply the iterator (i) terminal by 2 for the first index and then add 1 to it for the second (you'd need to run the loop half as many times of course). This would be more efficient and easier to read in your code. One other tip is that when you are running a loop a specified number of times it's cleaner to use a for loop rather than a while loop.
Regards,
Ryan K.
NI

Similar Messages

  • How can I insert into a table other than the default table in a form

    Hi,
    I want to insert into a table with some fields value of a form of another table. I have written insert code On successful submission of that form, but after submit it gives the following error
    An unexpected error occurred: ORA-06502: PL/SQL: numeric or value error (WWV-16016)
    My code is like this
    declare
    l_trn_id number;
    l_provider_role varchar2(3);
    l_provider_id varchar2(10);
    begin
    l_trn_id := p_session.get_value_as_number(p_block_name=>'DEFAULT',p_attribute_name=>'A_TRANSACTION_ID');
    l_provider_id := p_session.get_value_as_varchar2(p_block_name=>'DEFAULT',p_attribute_name=>'A_PROVIDER1');
    l_PROVIDER_ROLE := p_session.get_value_as_varchar2(p_block_name=>'DEFAULT',p_attribute_name=>'A_PROVIDER_ROLE1');
    if (l_provider_role is not null) and (l_provider_id is not null) then
    insert into service_provider_trans_records(service_provider_id,transaction_id,role_type_id)
    values(l_provider_id, l_trn_id, l_provider_role);
    commit;
    end if;
    end;
    Where 'PROVIDER1' and 'PROVIDER_ROLE1' are not table fields.
    How can do that or why this error comes ? Any idea?
    Thanks
    Sumita

    Hi,
    When do you get this error? Is it while running or while creating the form.
    Here is a sample code which inserts a non-database column dummy into a table called dummy. This is done in successful procedure.
    declare
    l_dummy varchar2(1000);
    begin
    l_dummy := p_session.get_value_as_varchar2(p_block_name=>'DEFAULT',
    p_attribute_name=>'A_DUMMY');
    insert into sjayaram903_1g.dummy values(l_dummy);commit;
    end;
    Please check in your case if the size of the local variable is enough to hold the values being returned.
    Thanks,
    Sharmila

  • How to put data into a array element in the BPEL

    Hi,
    I have a element in the WSDL which is of type Array. (i.e accepts unlimited data for the same element). How should i put a data into a array in the BPEL.
    Example:
    The below Example gives u an idea about wht iam asking:pasting a piece of my requirement:
    <s:element minOccurs="0" maxOccurs="1" name="parameters" type="tns:ArrayOfCSParameters" />
    <s:complexType name="ArrayOfCSParameters">
    <s:sequence>
    <s:element minOccurs="0" maxOccurs="unbounded"
    name="CSParameters" nillable="true" type="tns:CSParameters" />
    </s:sequence>
    </s:complexType>
    <s:complexType name="CSParameters">
    <s:sequence>
    <s:element minOccurs="0" maxOccurs="1" name="RevenueItem" type="tns:RevenueItem" />
    <s:element minOccurs="0" maxOccurs="1" name="AccountURIs" type="tns:ArrayOfString" />
    <s:element minOccurs="0" maxOccurs="1" name="GroupURIs" type="tns:ArrayOfString" />
    <s:element minOccurs="1" maxOccurs="1" name="Percentage" nillable="true" type="s:decimal" />
    </s:sequence>
    <s:attribute name="Version" type="s:decimal" use="required" />
    <s:attribute name="URI" type="s:string" />
    </s:complexType>
    Any suggestion is appreciated.
    Regards
    pavan

    You have 2 options i guess.
    Use the transformation and the for-each to construct the array-list
    or like Richard said, use a loop in bpel, assign in the loop an variable of element type="CSParameters" and append this variable to your variable with accepts the arraylist.

  • 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 insert into two differents tables at the same time

    Hi
    I'm newer using JDev, (version 3.1.1.2 cause the OAS seems to support just the JSP 1.0)
    and I want to insert into two differents tables at the same time using one view.
    How can I do that ?
    TIA
    Edgar

    Oracle 8i supports 'INSTEAD OF' triggers on object views so you could use a process similar to the following:
    1. Create an object view that joins your two tables. 'CREATE OR REPLACE VIEW test AS SELECT d.deptno, d.deptname, e.empname FROM DEPT d, EMP E'.
    2. Create an INSTEAD OF trigger on the view.
    3. Put code in the trigger that looks at the :NEW values being processed and determines which columns should be used to INSERT or UPDATE for each table. Crude pseudo-code might be:
    IF :NEW.deptno NOT IN (SELECT deptno FROM DEPT) THEN
    INSERT INTO dept VALUES(:NEW.deptno, :NEW.deptname);
    INSERT INTO emp VALUES (:NEW.deptno, :NEW.empname);
    ELSE
    IF :NEW.deptname IS NOT NULL THEN
    UPDATE dept SET deptname = :NEW.deptname
    WHERE deptno = :NEW.deptno;
    END IF;
    IF :NEW.empname IS NOT NULL THEN
    UPDATE emp SET empname = :NEW.empname
    WHERE deptno = :NEW.deptno;
    Try something along those lines.
    null

  • How to split words in two arrays depending of the first letter.

    Yes, how to split words in two arrays depending of the first letter.
    I have a string array with some words, and I need to separe this array into two differents string arrays depending of the first letter:
    if the word starts in A to M the word goes to array Words_AM;
    if the word starts in N to Z the word goes to array Words_NZ;
    Now I'm doing the next:
    if ((ArrayWord.charAt(0))<='a') && (ArrayWord.charAt(0)>='m'))                                        {                                                                                          
    Words_AM]=ArrayWord;
    else
    Words_NZ[i]]=ArrayWord;
    But doesn't work.
    Any solution?
    Best wishes.

    Yes , that's true. But also I have to change the <='a' to <'a', because of with first option didn't selecting the a letter.
    But with z letter, doing the same before, doens't run.
    if ((ArrayWord.charAt(0))<'a') || (ArrayWord.charAt(0)>='m'))
       Words_NZ]=ArrayWord;
    else
    if ((ArrayWord.charAt(0))<='n') || (ArrayWord.charAt(0)>'z')) Words_AM[i]]=ArrayWord;
    Regards ;)

  • How i can insert an youtube movie in to the keynote?

    how i can insert an youtube movie in to the keynote?

    Down load if it has been allowed by the author, then drag and drop on the slide.

  • HT201302 How to delete photos from camera roll only, let the rest remain in albums? Is there any no-PC or no iTunes solution for this?

    How to delete photos from camera roll only, let the rest remain in albums? Is there any no-PC or no iTunes solution for this?

    If these are albums, you created on your phone, using pics in your camera roll, you delete the pics from your camera roll & they will be deleted from the albums as well. The albums don't actually contain any photos, only pointers to the actual photos, which are in your camera roll.
    So, the answer to your question is no.

  • Ive bought my ipod touch of my friend and its still go his email address on the apple id how do i log into my apple id on the ipod?

    ive bought my ipod touch of my friend and its still go his email address on the apple id how do i log into my apple id on the ipod?

    Go on settings, then go on store, then click on the apple ID, then iForget

  • HT1414 I loss my iphone 4, got a iphone 5 and try to restore the iphone info from my laptop.  But the itune requires a password, which I forgot (I set this up two years ago!).  How can I get into my itune to restore the iphone info.

    I lost my iphone 4, got a iphone 5 and try to restore the iphone info from my laptop.  But the itune requires a password, which I forgot (I set this up two years ago!).  How can I get into my itune to restore the iphone info.

    Go to appleid.apple.com and try to login there. If unsuccessful, there is a link to change your password.

  • Retrn result only if both conditions are true

    I have this query to get list of names that are associated with
    a keyword called 123 but do not belong to a item named 456
    select distinct t1.lname, t1.sname , t5.rname
    from table1 t1, table2 t2, tale3 t3,
    table4 t4, table5 t5,
    TABLE(xmlsequence(extract(t4.xmlcol,'/cs/lo/c'))) k
    where t1.id = a.id
    and t3.id = a.id
    and t4.id = t3.id
    and t5.id = t3.id
    <--1st condition -->
    and extractValue(k.column_value,'c/L/keyword/@id') in ('123')
    <-- 2nd conditon-->
    and t5.item not in (select distinct t6.name from table7 t7, table6 t6
    where t7.id= t6.id
    and t6.ref_id = 456)
    In my database, I have 2 names. for a
    given lname in the output, it is associated
    with 2 rnames.One rname is associated with
    keyword 123 and the other rname is associated
    with item 456. Something like this:
    lname   sname   rname
    jakal     jkl      r123 --> associated with keyword 123
    jakal      jkl      r456 --> associated with item 456
    So when I run without condition1 and condition2 above is what I get.
    That is jakal is associated with both r123 and r456.
    However in my first query, I am trying to get the lnames and snames that are associated with keyword 123 but are not associated with item 456.
    I want both conditions true to be displayed.
    However when I write the query as mentioned initially, I get the row back.

    Not sure if I understand the problem correctly.
    But simplistically boolean algebra says that if you want a result only if both conditions are true, use AND.
    E.g.
    select * from table where <condition1> and <condition2>
    Now if this does not work, it means that the conditions do not do what you think these should be doing.

  • How to use "insert into & select" in format search

    Hello,
    I am just wonderring whether you can help me solve this issue.
    I want to change the value of a field in the title area for a sales quotation. however, this field is not shown up on the interface.
    For example, there is a field in the title area, "OQUT.Ref1". You actually cannot see this field from the quotation interface or any other doc. Now I want to update the value of this field.
    What I am now trying to do is to create an field named "update" in the title area, use format search to update. the code for the command will be something like
    Insert into $[OQUT.Ref1.0]
    select $[OQUT.U_MFG#]
    here, U_MFG# is UDF. as you may understand, I want to copy the value in the U_MFG# to the field of "Ref1".
    However, when I run "Execute", it gives me error. I believe there is something wrong with the code of "Insert into $[OQUT.Ref1.0]
    Does anyone know how to write the code?
    many thanks
    Stanley

    Thanks both Suda and sagar. The reason I wanted to do this is because I wanted to have UDF info be shown on the  MS word-templated quotation document.
    As you know, when you click the word symbol, a word-templated doc will be generated. The client needs two completely different format of quotation printout. thus I plan to print one type from PLD and other type by clicking the Word symbol. but later, I found out that the UDF field cannot be selected on the MS word template, or only system fields.
    Thus, the only way I can do is to copy the value from udf to some unused sytem fields and then show that system fields on the MS word template.
    any idea do you have?
    I wanted to tell SAP that It is not useful if the udf fields cannot be inserted into word template.
    thanks
    Stanley

  • How do i insert into table through forms

    Hi
    I have developed a custom form based on custom table.
    the only way to insert data into database table is through form.
    there are two tables: one table is to store all contract details & second table is to maintain history forthis.
    one condition(col1,col2,col3,col4) are unique combination,we are not creating any PK or FK at database level.evrythng is captured at form level.
    if all 4 columns combination exist thn e should not insert that record.
    if 4 columns combination doesnot exist then insert into table.
    I have used just pre insert,pre update triggers.
    I think its a basic form functionality ,by itself it inserts ,update record.now it is doing the same thng.
    But I have to add the above condition ,how can i do that.
    Pl provide me some ex code .
    Thank you.
    Hope any one can help me

    SQL> create table t
      2  (object_id    number
      3  ,object_name  varchar2(30));
    Table created.
    SQL>
    SQL> create sequence t_seq;
    Sequence created.
    SQL>
    SQL> insert into t (object_id, object_name)
      2  select t_seq.nextval
      3        ,object_name
      4  from   all_objects
      5  ;
    52637 rows created.

  • How can I insert into a view cache???

    I have a problem in JClient like that:
    A form that have 3 JTable:
    - Table1 get data from UserTable in DB
    - Table2 get data from GroupTable in DB
    - Table3 get data from GroupTable in DB
    and 2 buttons: btnAdd, btnRemove.
    When I select a row in Table1, Table2 will get all records in GroupTable that row in Table1 belonging to and Table3 will get all records in GroupTable that row in Table1 not belonging to.
    I want that when I select some rows in Table3 and click btnAdd then those rows in Table3 will be insert into Table2 and remove those rows from Table3. And when I select some rows in Table2 and click btnRemove then those rows in Table2 will be insert into Table3 and remove those rows from Table2.
    Can you show me how to show that problem.
    Thanks.

    Hi,
    When do you get this error? Is it while running or while creating the form.
    Here is a sample code which inserts a non-database column dummy into a table called dummy. This is done in successful procedure.
    declare
    l_dummy varchar2(1000);
    begin
    l_dummy := p_session.get_value_as_varchar2(p_block_name=>'DEFAULT',
    p_attribute_name=>'A_DUMMY');
    insert into sjayaram903_1g.dummy values(l_dummy);commit;
    end;
    Please check in your case if the size of the local variable is enough to hold the values being returned.
    Thanks,
    Sharmila

  • How do i insert into temp table

    Hi ALL,
    I have a table APP
    APP_I Acronym Desc
    1 ACC Accounts
    PLTFRM
    swr_pltfrm_i swr_pltfrm_x swr_pltfrm_typ_x
    1 AIX-JAVA Execution
    2 COBOL/BATCH Execution
    3 COBOL/CICS Execution
    4 CONSULTWORKS/MOBILE Delivery
    5 CONSULTWORKS Delivery
    PLTFRM_APP_ENVT
    swr_pltfrm_i app_i
    1 1
    2 1
    3 1
    4 1
    5 1
    I want to create one temporary tab
    TEMP_insert(app_i,desc, acrnymc ,delivery,execution) which have this columns
    App_i desc acrnymc execution
    1 Accounts ACC AIX-JAVA,COBOL/BATCH,COBOL/CICS
    delivery
    CONSULTWORKS,CONSULTWORKS/MOBILE
    How do i insert the row in to the Temp_Insert table based on APP_I as input to my stored procedure.
    Thanks

    hopefully this will help
    dev>declare
      2      cursor c is select empno,ename,job from emp where deptno=20 and rownum<3;
      3      str varchar2(100);
      4  begin
      5      for cur in c loop
      6          str:=str||' '||cur.ename||' '||cur.job;
      7      end loop;
      8      insert into emp_test (ename) VALUES(str);
      9  end; 
    10  /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.00
    dev>select ename from emp_test;
    ENAME
    SMITH CLERK JONES MANAGER
    [pre                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Maybe you are looking for

  • Jabber 9.5 phone service not registering over VPN

    TCT devices register fine over Any Connect VPN until I upgraded to 9.5! After upgrade IM/P and Voice Mail services connect successfully over VPN but phone service indicates it fails to get configuration from server. Everything works locally.  Any ide

  • Low Level SSL read is not working !

    Hi, I can readLine() from a buffered SSL socket without any problems. But I can't get the last line because the last line does not contain any <CR> or <LF>. So, when I try to do a low level read from a raw SSL socketstream, I always get "zero bytes a

  • Zen Sleek Photo, wont conn

    Well, I first updated the firmware becuase it had start up problems, so after that it worked fine. A few days after, I wanted to add some new songs, but it wouldn't connect.. I have tried it on all the computers in the house-3 of them, 2 desktops, la

  • Apple tv has no power

    My apple tv has no power, worked fine yesterday, today there is no status light, tried unplugging, tried menu+down buttons

  • Using Family Sharing without sharing payment method

    I love the family sharing feature. My yougest daughter is in the family sharing group. I want my oldest daughter to be in it to, to use the shared photo group, and the calander and the location sharing. However, I don't want her to buy things using m