Prevent negative values

Hello

I want to subtract values 15

REG

============

1

15

20

I want to make sure if the resulting value is negative (IE less than zero) the result would be 0

Outputs for the above data are

0

0

5

respecticvely.

My solution is

When case (reg-15) < 0 then 0

end else (reg-15)

Is there any better method as any function that do the same logic.

Pls help

I use oracle 10g

Hello

GREATEST (reg - 15

0

)

Returns 0 if reg-15 is negative.

Tags: Database

Similar Questions

  • Replace negative values in multiple channels with "0'.

    Hello

    I'm calculating and then by creating a cumulative channel, multiple channels. Negative values in these channels aren't necessary, and I need a nice way to replace each negative value in these channels with a value of '0'.

    My current code is:

    Do
    Do
    If Data.Root.ChannelGroups (2). Channels (i). Values (II)< 0="" then="" data.root.channelgroups(2).channels(i).values(ii)="0    ">
    II = ii + 1
    Loop until the second > Data.Root.ChannelGroups (2). Channels (i). Properties ("length"). Value
    II = 1
    i = i + 1
    Loop until I > Data.Root.ChannelGroups (2). Channels.Count

    It works, but I don't like. He adds a few seconds when running my script, which was almost instantly. Is there a better way to do it?

    Thank you.

    Hello Kevin,

    The fastest way to go through a channel and check the values less than or equal to 0 is through the canal's calculator. The code below takes all the channel first channel group (with the exception of the first string that is be the weather channel in my example data set) and replaces the values<0 with="" 0="" through="" the="" iif="">

    Set Group = Data.Root.ChannelGroups (1)
    iMax = Group.Channels.Count
    FOR i = 2 to iMax
    Adjust the strings = Group.Channels (i)
    Formula = "= IIF (y '.<0, 0,="">
    Call to calculate (formula, Array("y"), Array (Channel))
    NEXT ' I

    In this example we overwrite the existing values of data channel with 0, but you can also copy the channels to make sure that your raw data is available.

    The calculator of channel is extremely fast for this type of operation because it does not create a loop to go if each line separately and check the values he...

    I hope this is useful,

    Otmar

  • 'Variance PtByPt.vi' generates values of negative values for some input

    With certain sequences of input values the Gap PtByPt.vi can generate negative values. It is because of the precision in calculations.

    Because it is very common to calculate the gap by taking the square root of the variance, this behavior can take you by surprise because the result will be Nan and not almost 0 you expect. According to the data, this may be frequent or very frequent. In general, a nuisance to debug.

    The remedy is simple: take the Abs() before the square root value. A vi that demonstrates the case is attached.

    I would suggest to include this correction (or similar) in the "Variance PtByPt.vi' because it gives rise to unexpected and hard to find errors.

    By definition - variance cannot be negative.

    CAR 446514 discussed in this thread has been corrected in LabVIEW 2014.  For a more complete list of bugs fixed in LabVIEW 2014, see 2014 LabVIEW bugfixes. You can download a copy of LabVIEW 2014 evaluation at http://www.ni.com/trylabview/ or if you have a previous version of LabVIEW installed and an active subscription to SSP, you will be able to download the latest version of LabVIEW through NI Update Service.

    Kind regards

    Jeff Peacock

    Product Support Engineer | LabVIEW R & D | National Instruments | Certified LabVIEW Architect

  • How can I design square wave which has a positive and negative values equal to the other and separated from each other by controlled time or distance

    How can I design square wave which has a positive and negative values equal to the other and separated from each other by controlled time or distance, as indicated in the figure below. and enter this signal in a data acquisition.

    At the time wherever you go for the beautiful diadram, you could have done the vi

    Your DAQ would like a waveform (table of values and dt ak 1/sampling rate)

    If you set the sampling rate you know the length of the array, create a matrix of zeros and set the values of the two amplitudes...

    Because I don't want to connect other duties here are some photos

    And it does have a few drawbacks leaves to be desired in my solution, just think... rounding errors and what might happen if the tables are becoming more...

  • Cannot write negative values on server modbus on cRIO 9068

    Hello everyone,

    I'm moving a project from a platform of 9114 cRIO a cRIO9068, the reason for a difference of heavy in terms of power CPU, memory, performance FPGA etc...

    Real time I deploy a modbus TCP server, and I publish just I16 data.

    The problem comes when the program tries to write a negative value to a binded on modbus variable. This variable is in the same format (I16), the program could write negative values, between 0 and -32768, but whenever the modbus force set to zero.

    I tested the modbus also with the 'system of distributed OR 2014 Manager' but always impossible to write negative values on I16, but I can if I consider the data as I32!

    (see files)

    Furthermore, I deployed a modbus server on my PC and in this case, everything is fine.

    More information:

    I work with labView 14.0f1.

    The cRIO are installed 'Labview RealTIme 14.0.0' and 'server Modbus I/O 14.0.0.

    I tested the feature on three different cRIO 9068 with the same result.

    I think it's something wrong with cRIO 9068, can anyone help me?

    Thank you

    MZ

    Hi, Marcello,.

    I was able to reproduce the problem cRIO 9068 and it look like a CAR (corrective action request). I've opened a request for Corrective Action (AUTO ID 511039) to report the issue OR R & D.

    Have you tried to implement MODBUS slave on ana MODBUS master PC on cRIO? I tried and it works even with I16 data types.

    I hope this will help you.

    Kind regards.

    Claudio Cupini

    OR ITALY

    Technical support

  • Tension running from negative to positive to a negative value again using a structure case

    Hello

    I a VI that takes place (not shown) DAQ hardware and want to do the following with it:

    By feeding the starting value (the maximum negative value of voltage), increase (positive) and the end value (maximum positive) voltage for the DAQ hardware TRADERS (should be

    shown in the digital display) should go to gradually change from negative to positive maxima and do the reverse process of return to the starting value

    which is the maximum negative value.

    for example

    If I put - 3V to the starting value, 0.5 as increment, + 3 V to the end value, I should get the following:

    -3, -2,5, 2,...,.0,..., 2.5, 3 and then 2.5, 2..., 0,...,-2, 2.5-3, then stops.

    I managed to get the first which is negative to positive Maxima but he never do otherwise. Can anyone help with this.

    Thank you very much

    Alain

    Study the attached example.  Instead of having just a graph showing each DC voltage at each iteration, I made a graph that will update to show all the steps as they occur.  The waveform that is the scale of things is to properly size the chart so you can see each stage without having the graph resize with each iteration of the loop.  You can pass values to your DAQ hardware to get the real exit.

    I used a second shift for such direction suggested by Altenbach register.  It is to go to the best (maybe the only way).

  • Replace negative values of table 2d

    Hi all

    I have a large dataset I want for post processing... My data are in the form of a 2D array of typically 1e5 + lines by 100 + models! I want to replace all the negative values in the table with zeros.

    My initial was however to use two indexed for loops with a structure of matter inside looking for > 0 condition. However, this way I'm practically rebuild the table from scratch and it takes forever (had to give up after about 5 minutes of Calc, while I was still less than 10% of fact). I've attached a snapshot of my sample vi for your review.

    Is there a more efficient and faster way to do this?

    Thanks a lot for your time,.

    Harry

    There are many ways to do this, but in your case I would just wire table 2D to a primitive range and Coerce (from the palette of comparison) with the range of 0 to + infinity.

  • remove the negative values in table

    I have a table 1 d of data depending on the positive and negative values. I'm trying to search for negative values and remove them from the table.  This corresponds to the data in the column in the second table 2D that should also be deleted. A minor problem is that there are an additional column in the 2D array that must be skipped.  I have the code that should do it.  The problem is that if I have two negative numbers in a row the code doesn't thow on the other.

    This first picture is the answer I get when alternate positive and negative values.  It shows the correct answer.

    When I change the first1 of the positive a-1 value as shown below...

    ... I get the following response.

    FYI, some other things such as conversion are here because I'm trying to manipulate the actual data set is enormous.  I test everything I do with the numbers that I can actually follow before I apply in my real program.  That's why I do extra things.

    Thanks for the help!

    Here is the solution, that increase the index when you do not remove an element. In addition, whether you use the "less then or equal" when you use the "lower to."

  • 10g BEEP format-number for negative values does not

    Hi all

    I tried the following methods to get the negative number locked up with symbols ().

    1 update the mask of BI Publisher properties of field format to

    "#, # 0.00;(#,##0.00).

    2 tried the Oracle formatting options

    <? format - number:A.INVOICE_AMOUNT; "PT999G999G999G999G999G999G999D00? >

    What gives me the result as below,

    Output value

    23.45 23.45 - print correctly

    -12.90 (12.90 - closing paren "")' does not print

    Please help me get the parenthesis when generating the PDF file.

    Thank you

    I had the question.

    This is the format that was used in your model

    ###,###,###,###,###,###,###,##0.00;(#)

    The first half before; does the mask so no problem.

    But after; which is for negative values and that is not the correct format.

    Please use this format on the properties of form field that gives you good number format

    #, ##0.00;(#,##0.00)

  • I'm not able to use the keyboard to type negative values in the mode of developing LR6. Whenever these negative values are reset to zero. Can someone help me?

    I use LR 6/CC 2015.

    Whenever I type in a negative fashion develop it is reset to zero after entry or tab.

    I type in positive values remain and are not reset to zero.

    In older versions of Lightroom, I had no such problems.

    I have an iMac 27 with Yosemite 10.10.3.

    Hope someone knows how to fix this annoying problem.

    Your LR is configured in one language other than English?  If so, this is a known bug.  See the remark made by Simon Chen employee under this post (you need to click on see more reviews to actually see): 6 Lightroom: Bug of negative values (in German).   The comment includes a workaround solution that is to edit a text TranslatedStrings.txt.

  • Checking the negative value

    Hey guys I have a result on the ground which is of type varchar, but it stores numbers. I want to check if the value is negative or not. The code below works perfectly except for 1 case where the result has only ' - '. -indicates a missing value not a negative... How this can be fixed. Here is my code snippet.
    -Search for numeric values
    IF (trim (TRANSLATE (resvalue,'+ -. 0123456789', ' ')) IS NULL) THEN
    -Look for the negative value if the value is numeric
    IF (substr (resvalue, 1, 1) = '-' AND substr (resvalue, 0, 1) is not null) THEN
    v_ret_msg: = v_result_name | "" A negative result. "

    Also check the LENGTH of resvalue.
    That is to say:
    If length (resvalue) = 1 and substr (resvalue, 1, 1) = '-' then...

  • TLF - main negative values TextFormat text

    TLF does not support negative values for 'leader' (like classical text)?

    Copy the following code:

    var tf: TextFormat = new TextFormat();

    TF. Leading = - 50;

    myText.setTextFormat (tf);

    works very well in "Classic text" but not of TLF.

    TRACE is the same in both cases (Classic, TLF) result operating system:

    trace (myText.getTextFormat (.leading));  // -50

    But actually LESS the VALUES have no effect, and it's exactly the same when spacing is 0.

    Any solution for this please?

    Thank you very much.

    (Actual design when I apply different amounts of foreground based on a function of the horizontal line of the BOTTOM part)

    leading.png

    Moreover, I also checked the same thing with 'Arial' & 'Tahoma', is not a unicode question (Asian fonts).

    After much playing with the code, I could solve it with a funny code!

    When I put leading to a number, it fails to show the GOOD LINE SPACING:

    TF. Leading = - 50;  or ZERO or ANY OTHER NUMBER.


    When I just didn't attack (!) value or the value 'null' (as it is by default), then line spacing becomes as it should!

    TF. Leading = null;

    Hope this might help others


  • negative value to redo the size in Sp report

    Hi all

    I have 4 node RAC, HACMP & Oracle 9.2.0.8 on AIX 5.3.

    Here is the example of Stats Pack report. I find the values of ve - to redo size per second.
    What it means?
    Pls take a look. Pls suggest.
    STATSPACK report for
    
    DB Name         DB Id    Instance     Inst Num Release     Cluster Host
    ------------ ----------- ------------ -------- ----------- ------- ------------
    XXXXXXX       XXXXXXXXX   XXXXXXXXX            1 9.2.0.8.0   YES     XXXXXXXX
    
                  Snap Id     Snap Time      Sessions Curs/Sess Comment
                --------- ------------------ -------- --------- -------------------
    Begin Snap:     82369 04-Jan-12 05:00:03      405 #########
      End Snap:     82370 04-Jan-12 06:00:41      406 #########
       Elapsed:               60.63 (mins)
    
    Cache Sizes (end)
    ~~~~~~~~~~~~~~~~~
                   Buffer Cache:    12,288M      Std Block Size:         16K
               Shared Pool Size:     3,312M          Log Buffer:      4,096K
    
    Load Profile
    ~~~~~~~~~~~~                            Per Second       Per Transaction
                                       ---------------       ---------------
                      *Redo size:           -890,917.38           -447,550.05*
                  Logical reads:             29,698.77             14,919.10
                  Block changes:              1,056.20                530.58
                 Physical reads:              2,332.90              1,171.93
                Physical writes:                 39.46                 19.82
                     User calls:              5,313.03              2,668.98
                         Parses:                406.04                203.97
                    Hard parses:                  0.02                  0.01
                          Sorts:                395.07                198.46
                         Logons:                  0.28                  0.14
                       Executes:                609.08                305.97
                   Transactions:                  1.99
    
      % Blocks changed per Read:    3.56    Recursive Call %:      0.57
     Rollback per transaction %:   10.66       Rows per Sort:     20.69
    
    Instance Efficiency Percentages (Target 100%)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                Buffer Nowait %:  100.00       Redo NoWait %:    100.00
                Buffer  Hit   %:   92.15    In-memory Sort %:    100.00
                Library Hit   %:   99.98        Soft Parse %:    100.00
             Execute to Parse %:   33.33         Latch Hit %:     99.92
    Parse CPU to Parse Elapsd %:    1.88     % Non-Parse CPU:     99.92
    
     Shared Pool Statistics        Begin   End
                                   ------  ------
                 Memory Usage %:   34.71   34.94
        % SQL with executions>1:   82.41   82.46
      % Memory for SQL w/exec>1:   81.30   81.79
    
    Top 5 Timed Events
    ~~~~~~~~~~~~~~~~~~                                                     % Total
    Event                                               Waits    Time (s) Ela Time
    -------------------------------------------- ------------ ----------- --------
    db file sequential read                         7,824,742      10,471    53.48
    global cache cr request                         6,522,122       7,749    39.58
    CPU time                                                        1,037     5.30
    db file scattered read                             87,420         157      .80
    inactive transaction branch                            60          57      .29
              -------------------------------------------------------------
    Concerning
    MAS

    In the link below a forum member has also been confronted with this situation and has said something like he needs to apply a patch if it is the version 9i:
    STATSPACK redo size negative value?

    Concerning
    Girish Sharma

    Published by: Girish Sharma on June 25, 2012 15:12
    And answer below MOS note ID 308414.1 it why it is negative in 9.2.0.8.

  • CS5 - negative values

    I'm in following this tutorial, so I do nice things step #9 it says negitive values and Photoshop CS5 does not allow negative values? He mentions a diameter setting, which was replaced by a parameter of size of CS5, even once I can't enter negative values?

    They do not enter negative values.  Dashes are just separates the text from the number they want you to enter.  They should probably used colon.

    Look at the screenshot they provided.

    -Christmas

  • validation to regret the negative values...

    I have a class called "P14_No_of_days"...

    In this field the negative value should not accept that any validation is there?

    pls help me guys

    SKUD,

    Put code next under Edit Item-> HTML Form Element section "attributes".

    onkeyup='this.value=this.value.replace(/[^0-9]/g, "");'
    

    It will limit users to enter non-numeric characters.

    Kind regards
    Hari

Maybe you are looking for

  • Software conflict

    Hey fam... I have a serious problem. I think that the last updated OS (10.10), he created a software conflict somewhere. When I connect it goes into perpetual search mode, and then my machine just stops. If I sign up in any accounts or the comments o

  • Change release v3.6 v8?

    Who are you? I use FireFox for several years now. I periodically check the updates. Today, I was informed that v3.6 was obsolete and replaced by the v8. I try to keep abreast and the jump from version seems irrelevant. All attempts to contact Mozilla

  • Is there a problem with gish, I get a blank screen.

    Is there a problem with gish it? I get a white screen when I try to use the email addresses. This has happened for several days. This has happened Each time Firefox opened Is a few days ago

  • EliteBook 745 G2: Troubleshooting the AMD video driver

    Hi all! I have reported problems difficult to solve by myself, I found. I have a hp elitebook 745 G2 for my personal use. I've updated to windows 10 a week ago, but since I met many BSOD and PC freezes, so I did a clean Windows 10 operating system in

  • lap top stops when I go on gameon facebook why

    game application stops my lap top