Add value only when true

hi I am making an array with the iteration values of for loop by chechking the conditions and i want it to be done only when my condition is true.
But now what is hapenning is that if the condition is false 0 is over wirrting my values.
And also i have put two for loops inside a for loop.
the second for loop is running to the first loop iterations.
thanks in advance
 I am adding the vi i have made .
@nk
Attachments:
get excel data.vi ‏37 KB
get excel data.vi ‏37 KB

Hi @nk
That's because you have set "Use default if unwired" on the output tunnel of the Case Structure.
Hence if the condition is true, it will only output an array of only 1 iteration value at the output tunnel of the most inner For Loop
And if the condition is false, it will output an array with default value of 0 at the output tunnel of the most inner For Loop.
Also, it seems that 2nd For Loop does not have the auto-indexing feature enabled in the output tunnel, which only generate a 2D array, instead of 3D array in the Array 3 indicator. I wonder if generating 2D array output for the Array 3 indicator is what you want, but if you want to generate 3D array output, you should enable the auto-indexing feature for the 2nd For Loop.
And what you also should do is using the auto-indexing with conditional tunnel in the inner For Loop to automatically generate an array of iteration values if the elements in array is greater than the max value you've set as shown in the screenshot below for simple illustration.
Here is the link for more information about auto-indexing with conditional tunnel: http://zone.ni.com/reference/en-XX/help/371361K-01/lvhowto/condacc_valuesnloops/
Ee Lim
See that button on the left side of this post...
If you feel my post is helpful, all you need is just (at most) 2 seconds to click that button, to show your appreciation. Thank you~~

Similar Messages

  • APEX 3.0 Displaying the URL link for a column value ( only when not null )

    Consider the example :
    I have the following table with a column that may have urls to documents
    Row Column ( url_column )
    1 http://xyx.com/doc/doc1.pdf
    2 http://xyx.com/doc/doc2.pdf
    3 (null)
    How do i display the column so that a the link shows up only if a value exists.
    Setting the URL to #URL_COLUMN# in the 'Column Attributes' screen creates a problem when the value is null ( for Row 3 in above eg.)
    Thanks for your help

    I would handle it in the query itself, something like
    select x, y, z,
           decode(url_column, null, null,
                    '<a href="'||url_column||'">'||
                     url_column||'</a>') as url_column
      from wherever

  • How to add actions only when the stage playhead passes a label/certain time?

    I have an animation that is 2 seconds long. On the 1 sec mark there is sym.stop(); and a label called 'in'. At the 2 sec mark there is another sym.stop();
    So what I want to happen is for the animation to play up until 'in', then on mouseenter for the stage have sym.play();, and on mouseleave sym.playReverse();. This will make it so that only the second half of the animation will get played on mouseenter/leave.
    My problem is that the mouseenter/leave also gets applied to the first half of the animation, not allowing the second half to animate if the user mouses over during the first half. I know this requires an if statement but I don't know how to write it. So it would be something like this: if the playhead reaches 'in', apply mouseenter/leave actions.

    yes, I am. By the way I've found the solution. Someone might find this usefull.
    In design.xml having
    <component name="ExtendedTextInput" namespace="mynamespace" category="beta" displayName="ExtendedTextInput"/>
    use this
    <component name="ExtendedTextInput" namespace="mynamespace" category="beta" displayName="ExtendedTextInput">
            <defaultAttribute name="text" value="ExtendedTextInput"/>
        </component>
    so when adding this component to design view, it will have text setted to value ('ExtendedTextInput' in this case).

  • Add counter only when duplicate segments are present in mapping

    Hi Gurus,
    I have a FILE to FILE scenario, and the source file is as this:
    aaa aaa aaa
    bbb bbb bbb
    ccc ccc ccc
    ccc ccc ccc
    ddd ddd ddd
    and the structure will be as:
    <Row>
    field1> aaa
    field2> aaa
    field3> aaa
    </Row>
    <Row>
    field1> bbb
    field2> bbb
    field3> bbb
    </Row>
    etc
    In the target structure, I need to have the same elements, but there is one more field which is a counter field that need to be increased for each repetitive line and then reset back to 1 for a non-unique one.
    So regarding the source structure, the target one should be as this:
    <Row>
    field1> aaa
    field2> aaa
    field3> aaa
    counter> 1
    </Row>
    <Row>
    field1> bbb
    field2> bbb
    field3> bbb
    counter> 1
    </Row>
    <Row>
    field1> ccc
    field2> ccc
    field3> ccc
    counter> 1
    </Row>
    <Row>
    field1> ccc
    field2> ccc
    field3> ccc
    counter> 2
    </Row>
    <Row>
    field1> ddd
    field2> ddd
    field3> ddd
    counter> 1
    </Row>
    etc
    I am asumming that I need to do this using UDF and local variables, but what I don't know is how can I compare the actual Row data with the previous one so I can increase the counter (or reset it).
    Any idea on what can I do here?

    Hi,
      You can try the below logic to get the counter incremented according to the row. For all fields its simple one to one mapping except counter.
       Row----Row
       field1---field1
       field2---field2 etc
    for counter concat field1,field2,field3 with empty delimiter ...
    concatinationof3fields--removecontext-sort-splitbyvaluechange-UDF-splitbyeachValue--counter
    **execution type of UDF is Allvalues of a context.
    public void UDF(String[] var1, ResultList result, Container container) throws StreamTransformationException{
              ArrayList aList =  new ArrayList();
         int counter = 1;
         int cnt = 1;
         for(int i=0; i<var1.length; i++){
                  if(aList.contains(var1<i>)){
              cnt++;
              result.addValue(cnt);
                                 else{
              aList.add(var1<i>);
              result.addValue(counter);
    Regards
    Priyanka

  • [ASK] popup return value only able to be displayed in disabled inputtext

    Hi,
    I'm using Jdev 10.1.3.
    I have an inputtext and a commandbutton that triggers its value by selecting it from a popup window.
    The problem is the inputtext will be able to display the returned value only when its "disabled" attribute
    set to true. I need this inputtext to be enabled. Am i doing something wrong?
    This is what I'm doing:
    <af:panelGroup layout="horizontal">
          <af:inputText value="#{processScope.glCode}" binding="#{productBean.glCodeInputText}" disabled="true"
                                   id="glCodeValue" partialTriggers="dialogPopUpGlCode"
                                   required="true" requiredMessageDetail="Select a GL Code for this Product"/>
          <af:commandButton text="..." shortDesc="GL Code List" action="dialog:glCodePopUp" id="dialogPopUpGlCode"
                                   partialSubmit="true" useWindow="true" immediate="true" windowHeight="300" windowWidth="300"
                                   returnListener="#{productBean.onReturnFromSelectGlCodeDialog}">               
          </af:commandButton>
    </af:panelGroup>Backing bean:
        public String onReturnFromSelectGlCodeDialog(ReturnEvent returnEvent){
            returnGlCodeId = returnEvent.getReturnValue().toString();
            if (returnGlCodeId != null) {         
                PolicyMaintenanceModuleImpl policyMaintenanceModuleImpl = null;
                try {
                    policyMaintenanceModuleImpl = getPolicyMaintenanceModuleImpl();
                    Product_ParamGlCodeViewImpl paramGlCodeVo = (Product_ParamGlCodeViewImpl)policyMaintenanceModuleImpl.getProduct_ParamGlCodeView();
                    paramGlCodeVo.setWhereClause("PARAM_GL_CODE_ID = '"+returnGlCodeId+"'");
                    paramGlCodeVo.executeQuery();
                    while (paramGlCodeVo.hasNext()) {
                        Product_ParamGlCodeViewRowImpl row = (Product_ParamGlCodeViewRowImpl)paramGlCodeVo.next();
                        returnGlCode = row.getGlCode().toString();
                finally {
                    releaseAM(policyMaintenanceModuleImpl);
                ((AttributeBinding)getBindings().getControlBinding("GlCode")).setInputValue(returnGlCode);
                JSFUtil.setProcessObj("glCode",returnGlCode);
            return null;
        }Please help..T_T
    Thanks a lot..

    Thanks Shay, I've followed your suggestion but with no luck..
    <af:selectInputText required="true" columns="#{bindings.GlCode.displayWidth}"
                                            windowHeight="300" windowWidth="300" simple="true"
                                            action="dialog:glCodePopUp" value=""
                                            binding="#{productBean.selInputTextGlCode}"
                                            returnListener="#{productBean.handleGlCodeReturn}"/>What do I should put in the "value" attribute? I've tried #{bindings.GlCode.inputValue} but if I do that then the selectinputtext will displayed in zero length (just a small vertical grey line) and with no such that green flash light image on the right. Because the main page is an add new form, so for the first time all the input is blank.
    This is the handling method in the add-new-page back bean:
        public void handleGlCodeReturn(ReturnEvent returnEvent) {
            GlCodePopUpBean glCodeBean = (GlCodePopUpBean)returnEvent.getReturnValue();
            if(glCodeBean == null)return;
             //setter lines
             String glCodeId = glCodeBean.getGlCodeId();
             String glCode = glCodeBean.getGlCode(); 
             getSelInputTextGlCode().setValue(glCode);
             getSelInputTextGlCode().setSubmittedValue(null);
             ((AttributeBinding)getBindings().getControlBinding("ParamGlCodeId")).setInputValue(glCodeId);
             AdfFacesContext afContext = AdfFacesContext.getCurrentInstance();
             afContext.addPartialTarget(getSelInputTextGlCode());
        }I've printed out glCodeId, glCode and getSelInputTextGlCode().getValue() after the setter lines, and all of them printed the right value, but it just not displayed in the inputtext!
    I've also tried using processScope - #{processScope.glCode} - and it also failed in displaying the value in the inputtext.
    I wonder what's wrong?

  • Displaying calculated field only when data exist

    Hello,
    Is there a way to display my calculated value only when the data entry field is being used. For instance, if I have several fields vertically aligned, I don't want to display a bunch of zeros if their data fields are not being used.
    THANK YOU!!!!

    You can check for the rawValue in the Calculate event before any script.
    Event: Calculate
    //FormCalc
       if(Field1.rawValue ne null) then
         // write your script here
       endif
    //JavaScript
    if(this.rawValue != null){
       // write your script here
    Thanks
    Srini

  • How to get the value incremented only when the loop is true?

    Hi,
       From the snapshot attached, i want to increment the value of number indicator only once when its true and should increment the value again when the loop is true..i mean i want to get the number of times the loop is true.
    But in this vi i am getting the value incremented many number of times when the loop is true because the while loop is running continuously. 
    Attachments:
    labview.docx ‏54 KB

    muralicgowda wrote:    From the snapshot attached, i want to increment the value of number indicator only once when its true and should increment the value again when the loop is true..i mean i want to get the number of times the loop is true.
    But in this vi i am getting the value incremented many number of times when the loop is true because the while loop is running continuously. 
    A loop is a structure and not a boolean, so it cannot be false or true and thus I don't understand the question!
    Why don't you attach the actual VI instead of a word document? Your code is very difficult to understand because it seems to suffer from severe localitis, and some of the few visible terminals don't show a label. What's in the other cases of the case structures?
    Incrementing a value is better done in a shift register or feedback node. What's the purpose of the "absolute value" function. As long as you make sure you don't start with a negative value, it should not be needed. If you are looking for a off-on transition, try "implies" with the current and previous value of the boolean. (For an example, have a look at this post and the quoted example in it.)
    Message Edited by altenbach on 01-21-2010 08:47 AM
    LabVIEW Champion . Do more with less code and in less time .

  • Field values erases when Add Row button is pressed in Master Detail Form

    Hi,
    I am using APEX 4.0. There is a master-detail form in a page, this has 5 rows in it by default, has a Add row and a Delete button. I face two problems now:
    1. When the values are entered in all the 5 rows, that are in default, and Add Row button is clicked, these values are entered in the DB, but they are erased from the interface. Means when user clicks Add row he don't see the old values he has entered. All new empty rows are only seen. This might confuse the user. How can I resolve this.
    2. The values are saved to the DB only when the Add row button is clicked, so suppose if the user enters some wrong values in the default rows and after he clicks Delete button, all the field values are erased. Is there a way to delete only that particular row? (Please note: the values are not saved to the DB, unless the Add Row button is clicked)
    Please let me know how to resolve these 2 issues.
    Thanks.

    So let me get this straight:
    You enter information into a tabular form and then click the add row and the data is being duplicated from the prior row or being inserted into the table ?
    Thank you,
    Tony Miller
    Webster, TX
    A lady came up to me on the street, pointed at my suede jacket and said "Do you know a cow was murdered to make that jacket?"
    "I didn't know there were any witnesses", I replied " Now I'll have to kill you too"

  • Set default value for people picker only when user checks a checkbox (Sharepoint 2010)

    The javescript in below link works for me.
    http://social.technet.microsoft.com/Forums/sharepoint/en-US/2b130f64-3db2-484a-9a53-ccbe18d2c5de/set-default-value-for-people-picker-in-list-template-current-user?forum=sharepointgenerallegacy
    However, I'd like to set default user for people picker only when user checks a checkbox. 
    I am new to  development. Could you please help me on this requirement ?
    Thank you very much. 

    Hello,
    Use this link to to validate checkbox value, if true then set the person or group value (i.e. as posted in your link).
    http://geekswithblogs.net/haniamr/archive/2011/03/10/validate-that-a-checkbox-is-checked-using-javascript.aspx
    Hope it could help
    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • How to run TCP/IP Tx in cRIO vi only when value changes?

    My design uses NI's TPC-2006 as the user interface for a cRIO-based product.  I use TCP/IP to exchange data between the TPC-2006 and cRIO.  My code causes the TPC to lock up after a variable number of minutes, typically about 10.  The OS is completely locked and requires a power cycle to recover.
    Based on the theory that the TPC-2006 is not keeping up with the TCP/IP packets sent by cRIO, I want to try configuring cRIO to transmit only when it has something new to say.  The event structure that I use for the TPC-2006 won't work on cRIO.  Can anyone out there suggest another approach?
    Jeff
    Climbing the Labview learning curve!
    Sanarus Medical
    Pleasanton, CA

    Hi Jeff,
    The simplest way to reduce transmission overhead in this scenario would be to encase your existing TCP/IP routine in a case structure that only executes if the data element you're interested in is not equal to its last value (stored in a shift register).  This shouldn't add much in the way of computational overhead on the RT side, but should reduce the flood of data if the value doesn't change very often.  Keep in mind also that if you have LabVIEW 8, you can use Shared Variables to send the data over your tcp/ip connection only when a new value is written to the variable - this may meet your needs just as well.
    Cheers,
    Matt Pollock
    National Instruments

  • Serv. Desk: Action: send an email only when a value in a field has changed

    Hello,
    In Soution Manager 4.0, Sevice Desk, I would like to create an action which creates an email only when a value of a certain field has changed.
    - only in change mode relevant
    - only when a value of one field has changed (e.g. Message Processort has changed from Buss. Partner 4 to 5. Than a mail should be sent to BP 5).
    - it should only send this kind of email when the field value has changed in change mode. In other words: it should not sent the email e.g. when the status has changed.
    I tried all kinds of things but I do not know on how to define the COnditions for an Action, so I can compare e.g.
    if <old value> <> <new value>
    Any ideas or experience on how to implement this without major modifications ?
    Thanks
    Christian

    Hi Christian,
    check out my question on SDN.
    Email on Status Change
    it has details on how to send an email when the status changes. I believe you are going to have to do something like this for each of the fields you want to create an Action Starting Condition for.
    regards,
    Jason

  • How to insert data into a table only when data has changed its value (when compared to the previous inserted value)

    I wish to insert data into a table only when the value of the inserted data has changed. Thus, in a time series, if the value of the data at time, t-1, is 206 then if the data to be inserted at time t is 206, then it is skipped (not entered).
    If the value of the data at time t+1 is 206, it is skipped also; until the value changes, so if the value at t+1 was 205, then that would be inserted, and if at time t+2 the data is 206, it would be inserted too.
    What is the best way to do it without increasing overheads?

    This view works:
    SELECT
    i.IDNO,i.[Date],i.[Level]
    FROM
    mytable i
    INNER
    JOIN mytable
    d
    ON
    d.IDNO
    = i.IDNO-1
    WHERE
    i.[Level]
    <> d.[Level]
    on this mytable below.  A trigger could be quite useful here although I am cautious using them. However I wish to avoid the overhead by not having a temp table (which could be sizable).  mytable below
    should give 3 lines. The IDNO is an identity column.
    IDNO
    Item
    Date
    Level
    1
    X24
    12/23/13 10:41
    22996
    2
    X24
    12/23/13 10:41
    22996
    3
    X24
    12/23/13 9:21
    23256
    4
    X24
    12/23/13 9:21
    23256
    5
    X24
    12/23/13 9:22
    23256
    6
    X24
    12/23/13 9:22
    23256
    7
    X24
    12/23/13 9:22
    22916

  • My youtube does not work on safari only when i try to play a video it says "This video is not available on mobile add to playlist" But i am using a mac air 11 inch it is not a mobile. Please Help. i have to use the youtube on firefox or chrome

    my youtube does not work on safari only when i try to play a video it says "This video is not available on mobile add to playlist" But i am using a mac air 11 inch it is not a mobile. Please Help. i have to use the youtube on firefox or chrome. At times it also say QuickTime Player can't open "video.3gp". and
    The file may be damaged or may not be a movie file that is compatible with QuickTime Player. when i try to open a video on youtube on safari

    I too am having the same issue as the OP.
    Your USER AGENT information is Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/600.3.18 (KHTML, like Gecko) Version/8.0.3 Safari/600.3.18
    Every webserver that receives a request from your browser is able to determine the HTTP USER AGENT information unless it has been removed by some software (e.g. firewall) before the request was trasmitted.

  • JavaScript Function Calls it is called twice only when add the component

    Hi,
    I am developing a SAP Design Studio Extension and I noticed that when I add the component on Application, SAP Design Studio calls the JavaScript SDK Functions twice only when I drag and drop the component.
    I found out about this just put an alert message in which JavaScript Function (init, beforeUpdate and afterUpdate).
    Is it ok to work this way?
    I am really curious if anyone else has come across this issue.
    Thank you,
    Fabio Almeida

    Hi Fabio,
    Yes, there does appear to be an issue with SDK component functions being called twice.  Mike Howles has implemented a workaround in this Toolbar example code. Refer to the code in the this.init function at the end.
    Regards,
    Mustafa.

  • Logging data only when value of tag increases

    Hello,
    I want to data log only when my tag value is increases another it will not log data in database.
    So how do I do this.
    Thanks & Regard
    Nitin Jain

    A functional global, which will look at the current value, compare it to the previous, and if the new value is greater, signal that fact, and replace the previous value with the new value. You probably want the comparison to have a range, or a threshhold, so that it has to have increased by a certain amount before this all occurs, also are you only concerned in increasing? If you signal were a slow sinusoidal one you would register increases all the way up one side of the waveform, then once the peak was reached no more data would be saved, unless of course the amplitude increased. Do a search on functional globals, Action Engines, to see what I'm refering to as a storage mechanism.
    Putnam
    Certified LabVIEW Developer
    Senior Test Engineer
    Currently using LV 6.1-LabVIEW 2012, RT8.5
    LabVIEW Champion

Maybe you are looking for

  • How to move Projects and Events with iPhoto video included in iMovie '11?

    I work with a group of educators using iPads for video. One method for getting their clips into iMovie '11 is via iPhoto and then using the iPhoto Video link in iMovie to get the footage on a timeline (trying to import directly into iMovie '11, using

  • How do I change the color of the triangle in a menu bar?

    Hi, I have a question that might seem very rudimentary...How can I change the color of the little downward-pointing triangle on my menu bar items that have sub-menus? Specifically, I want those triangles to be invisible when the cursor is not over th

  • [SOLVED] New arch install from Virtualbox cannot boot on real hardware

    Hi, I'm trying my luck with installing Arch on physical disk through Virtualbox. I followed Wiki and managed to install system on the disk. However, I am unable to boot it outside VM. I have two physical disks - /dev/sda and /dev/sdb. I have installe

  • [solved] change slim font

    hi to all i want to change slim font. how can i do ? thanks Last edited by nTia89 (2010-09-02 20:17:41)

  • 2nd gen shuffle loses music for no apparent reason

    I recently bought a 2nd gen shuffle and I've connected to my pc and uploaded music without any problems. However, while I'm using the shuffle, for some unknown reason - and completely at random, the shuffle seems to lose certain tracks, not all - jus