Range of numbers

Hello. I have just a simple range of numbers and I want to output the results. I will return results, but for some reason, it displays only the first result. Why t - he did not display the correct result? Here's what I have:

< cfset X = 27 >

< cfset Y = 37 >

< cfif (#X # 35 LT GT 51 and #Y # GT 1 LT 35) >

< cfset result = 200 >

< cfelseif (#X # GT 1 LT 35 and #Y # GT LT 51 35) >

< cfset result = 300 >

< cfelseif (#X # 35 LT GT 51 and #Y # GT LT 51 35) >

< cfset result = 100 >

< / cfif >

< cfoutput >

#Result #.

< / cfoutput >

Since X is 27 and Y 37 it should produce 300 as the result, but he shows 200. Why is this? What should I do to fix this? Thank you.

Andy

Basically you are trying to use logic X > 35<51 and="" i="" don't="" think="" cf="" supports="" this="" form="" of="" "between"="" logic="" and="" i="" have="" no="" clue="" as="" to="" what="" logic="" cf="" is="" actually="" performing.="" i'm="" surprised="" it="" is="" not="" puking="" out="" an="" error="" message.="" instead="">

Also the result is undefined if any of these conditions do not so it would be wise to include a block of final.

Tags: ColdFusion

Similar Questions

  • Is there a way to block a range of numbers?

    A group of Washington calls several times a day and I continue to block the numbers, but it's always a slightly different ending every time. Is there a way to block a range of numbers?

    No, it's not

  • How to find how many times, how many numbers in a range of numbers (number of lines and columns) has been repeated (numbers 3.6.2)

    Hello

    I have a range of numbers from B2 - B11 until the G2 - G11. For example:

    31

    7

    28

    10

    4

    17

    20

    13

    44

    2

    1

    39

    32

    45

    39

    4

    10

    25

    26

    38

    27

    43

    12

    3

    42

    35

    37

    1

    34

    21

    13

    39

    11

    14

    5

    37

    21

    33

    34

    4

    13

    10

    31

    14

    1

    24

    35

    3

    20

    2

    24

    27

    22

    30

    10

    34

    36

    32

    3

    27

    I would like to know who among these numbers have occurred and how many times. For example (just to have as an example): number 10 repetitions 5 times, number 13 repeated 3 times, 24 repetitions 9 times.

    Repeats = duplicates.

    I want to know all the repetitive number and how many times they repeat.

    Is there some kind of formula I can use to get there. It would be good to have the sorted result. For example:

    32 repeats 10 times

    24 repeat 9 times

    6 reps 8 times

    5 repeat 7 times

    22. repeat 6 times

    10 repeats 5 times and so on.

    Hello

    Problem of three steps:

    1. Determine the distinct values
    2. Count the number of times each appears in the table
    3. Sort by value or frequency (or both).

    The first step is easily handled by copy separate Automator Service, a Service of Automator, written by SGIII. A link to the file in post June 21 of the SG in this thread: Re: Analyzing column (maybe not the correct wording)

    After downloading and installing the service, select the cells containing the numbers, call the service, and then select the first regular (ie. non-header) cell to a new table and the dough.

    (The following assumes the new table has a header row, no column header, and you have selected - click - cell A2 before pasting.)

    You will get a list of distinct numbers in a single column (A2 - A34, of your sample and support of note).

    To count the numbers:

    In this example, the existing table is named 'Table 1'

    Enter the following formula in B2 the new table, and then fill up to the last line of the column B:

    = COUNTIF (Table 1::B:G, A)

    Results should be as shown:

    Sort the results on column (value) or B (frequency)

    Two types (A, then B) will be put in order of frequency, with values appear the same number of times sorted by value within this group.

    Kind regards

    Barry

  • Remove the range of numbers from a text string

    I have a field that I need to remove a certain range of numbers, however, this area is VARCHAR2 and can contain letters.

    My current code is (in the Where clause): field.field_name not between '27000000' and '27999999'

    The problem is that it takes also documents that are not in this range, such as 27000.

    What code can I set in the where clause to fix this?

    OK, then change the class alnum class numbers:

    SELECT *.

    From your_table

    If NOT of REGEXP_LIKE (your_col, ' ^ 27 [[: digit:]] {6} $');

  • Else IF (javascript) with a range of numbers

    I create form fields in a PDF using Acrobat.  There is a field that you enter an amount (1-20, 21-100, + 100), and according to what is entered, the cost will be different.  If 1 to 20 units are the cost will be $ 199 per unit, 21 to 100 units, the cost is $ 175 per unit and 100 units, the cost is $ 150 per unit.  The line on the document looks like: number of Entities___ X price per Entity___ = Total___.

    That's what I have so far for the price;

    If (this.getField ("No. of the entities') .value == '1') {}

    Event.Value = 199

    } else if (this.getField ("No. of the entities') .value == '21') {}

    Event.Value = 175

    } else if (this.getField ("No. of the entities') .value == '101') {}

    Event.Value = 150

    } else {}

    Event.Value = 0 / / value here by default

    }

    I have it working for one number, I can't get a range of numbers.

    Any help would be great, thanks.

    The problem is in the logic of your condition.  This will hit only when you have the value of 1, 21, 101.

    I suggest you another game of logic, based on<=>

    If (this.getField ("No. of the entities') .value<= '20')="">

    Event.Value = 199

    } else if (this.getField ("No. of the entities') .value<= '100')="">

    Event.Value = 175

    } else if (this.getField ("No. (of the entities') .value > = '101') {}

    Event.Value = 150

    } else {}

    Event.Value = 0 / / value here by default

    }

    or something in that sense.  I also imagine that given the operators be digital (without the quotes on the constant) would be more effective.

    But it's general advice for JS and not tried within a form.

    Also, I have a question for you.  Are design you this as a PDF form in Acrobat, or you use LiveCycle Designer?  This information will help when we move this question in the appropriate forum.

  • Count cells with a range in numbers

    Is it possible to have the numbers read the value in a cell and there is in a given range. For example: count the number of cells that have a value between 85 and 100.

    Something like that?

    = COUNTIFS(A,">="&85,A,"<="&100)

    COUNTIF works with pairs of columns-condition.

    SG

  • REGEXP_LIKE for more of a range of numbers.

    Hi all.


    It is a pleasure to receive your help.

    I use Oracle Database 10 g Enterprise Edition Release 10.2.0

    I want to leave a string of pairs of numbers (where each pair represents a range) to know if my setting number is between pairs.

    Something like the following.

    SQL:

    declare
      i     pls_integer := 0;
      s     varchar2(100) := '^([74010000-74019999]|[85990000-85990999])';
      test1 varchar2(8) := '64010000';
      test2 varchar2(8) := '74010000';
    begin
      begin
        select 1 into i from dual where regexp_like(test1, s);
        dbms_output.put_line(i);
      exception
        when no_data_found then
          dbms_output.put_line(0);
      end;
      begin
        select 1 into i from dual where regexp_like(test2, s);
        dbms_output.put_line(i);
      exception
        when no_data_found then
          dbms_output.put_line(0);
      end;
    end;
    
    
    

    With the expected result below.

    Output (It didn't happen):

    0
    1
    

    Actual output:

    1
    1
    

    Suggestions?

    I'm looking for the literal correct.

    I thank in advance

    Filippe

    No prob

    drop table test

    CREATE TABLE test

    (NUMBER n

    );

    INSERT INTO test (n) VALUES (64010000);

    INSERT INTO test (n) VALUES (74010000);

    with input_data as)

    Select regexp_substr (t.val, "[^;]") +', 1, level * 2-1) to_search, regexp_substr (t.val, "[^;]") +', 1, level * 2) end_num

    (Select '74010000; 74019999; 84010000; 84019999; 94010000; 94019999' VAL double) t

    connect regexp_substr (t.val, "[^;]") +', 1, level * 2) IS NOT NULL

    )

    Select

    *

    of input_data, test

    where

    n between to_search and end_num

    TO_SEARCH END_NUM N

    74010000 74019999 74010000

    Just to get the whole picture

    with input_data as)

    Select regexp_substr (t.val, "[^;]") +', 1, level * 2-1) to_search, regexp_substr (t.val, "[^;]") +', 1, level * 2) end_num

    (Select '74010000; 74019999; 84010000; 84019999; 94010000; 94019999' VAL double) t

    connect regexp_substr (t.val, "[^;]") +', 1, level * 2) IS NOT NULL

    )

    Select

    *

    Of

    input_data

    full outer join

    test

    on

    n between to_search and end_num

    TO_SEARCH END_NUM N

    74010000 74019999 74010000

    84010000 84019999-

    94010000 94019999-

    -6401000

    chris227: the entire image added

    be complete it shoul be "n between to_number (start_num) and to_number (end_num)" accuracy

  • Specific range of numbers

    Hello

    I have a numeric field, and I want to enter specific numbers in this area; number between 10 and 40.

    How can this be achieved?

    Please note that I am new to Livecycle Designer.

    Thank you in advance,

    On the exit event of the field that you need to write code that verifies that the user has entered a number in this range. Something like this javascript here:

    If (this.rawValue < 10="" ||="" this.rawvalue=""> 40) {}

    App.Alert ("you have entered a number that is outside the acceptable range. It must be between 10 and 40. "Please try again");

    xfa.host.setFocus ("insert the name of your domain here");

    }

    Hope that helps

    Paul

  • Help with SELECT - select the range of numbers

    Hello
    I need assistance with the SELECT statement. I want to choose Dates today and ending 30 days back. If the result would be like:
    TRUNC(SYSDATE)
    TRUNC(SYSDATE) - 1
    TRUNC(SYSDATE) - 2
    TRUNC(SYSDATE) - 3
    .
    .
    .
    TRUNC(SYSDATE) - 30
    I was thinking about truncated SYSDATE simply select in the first column and second column number 0, 1, 2... 30 then I'd just do a difference first column - second. But how to choose such sequence of numbers? I don't want to choose every number (date) in the select distinct statement, then Union them.

    Does anyone have an idea?
    Thanks for the help, Dan
    SQL> select trunc(sysdate) - level + 1 as dt
      2  from dual
      3  connect by level <= 31
      4  ;
    
    DT
    -----------
    07/01/2013
    06/01/2013
    05/01/2013
    04/01/2013
    03/01/2013
    02/01/2013
    01/01/2013
    31/12/2012
    30/12/2012
    29/12/2012
    28/12/2012
    27/12/2012
    26/12/2012
    25/12/2012
    24/12/2012
    23/12/2012
    22/12/2012
    21/12/2012
    20/12/2012
    19/12/2012
    
    DT
    -----------
    18/12/2012
    17/12/2012
    16/12/2012
    15/12/2012
    14/12/2012
    13/12/2012
    12/12/2012
    11/12/2012
    10/12/2012
    09/12/2012
    08/12/2012
    
    31 rows selected
     
    
  • Returns the rows of a range of numbers

    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0

    Hello

    Suppose we have a table that contains 2 columns, one is the beginning of range a second the end of it:
    with t1 as 
     (select 100 start_r, 250 end_r, 'R1' range_type from dual
      union all
      select 300 start_r, 350 end_r, 'R2' range_type from dual)
    select * from t1
    Is it possible to get an output like:
    CNUMBER    RANGE_TYPE
    100          R1
    101          R1
    102          R1
    .....
    250          R1
    300          R2
    .....
    350          R2
    Thank you very much, Alex.
    WITH t1 AS
         (SELECT 100 start_r, 250 end_r, 'R1' range_type
            FROM DUAL
          UNION ALL
          SELECT 300 start_r, 350 end_r, 'R2' range_type
            FROM DUAL)
    SELECT *
      FROM t1,
           (SELECT     LEVEL lvl
                  FROM dual
            CONNECT BY LEVEL <= (SELECT MAX (end_r) mx
                                   FROM t1)) t2
    where t2.lvl between t1.start_r and t1.end_r 
    
  • Problem seeking a range of numbers

    I hope someone can help. I have a question I need to select the results that come from the range of-30 to any positive number up to 70.

    My problem is that my query is trying to (for example)-95 as a number greater than-30 that is shouldn't.  Anyone know what I can use? Here's what I have:

    < cfquery name = "qcomp" datasource = "mydb" >
    SELECT id, id_comp, daysremaining, startdate, society, howmanyteams, compname, prospect, SUM (totallost) AS totallost
    THE DASHBOARD WHERE daysremaining > = '-30'.
    Compname group, prospect, identifiant_composant
    order of compname, totallost ASC
    < / cfquery >

    What is the data type of the field in the database?

    If it's a number-95 type is less-30 then.

    If it's a type of text/characters-95 is one more great then-30.

    And the quotes in which your clause says it's a type of text/characters:

    WHERE daysremaining >= '-30'
    
  • In the case of a range of numbers

    I don't know that it's really simple. but I can't find the words to search for find my answer.

    Series w for '19 '.

    If w is then {1 thru w}

    display the dialog box "on the beach!

    end if

    Thank you very much

    Matt

    I still did ' t ask the right question.

    define a '15 '.

    Series w for '19 '.

    If w is then {1 thru w}

    display the dialog box "on the beach!

    end if

    Opted for a work around.

    If ≥ 1 and an and aw ≤

    Display dialog box "In the beach!

    end if

  • find a number from a range of numbers...

    I have a table and the data as below... each id has sequencially number (from and to)
    Now I want to enter a number as a parameter as * 73 *... So how do I find the ID...
    ID           FROM             TO
    1              90                 100
    2              80                   89
    3              70                   79
    4              60                   69
    Published by: Selim_Rahman on October 24, 2011 06:38

    Hello

    Here's one way:

    SELECT     *
    FROM     table_x
    WHERE     73     BETWEEN from_num     -- FROM is not a good column name
              AND     to_num          -- TO is not a good column name
    ;
    

    If you had a table with a number any of target_nums (for example, 73), you can use BETWEEN as shown above in a join condition.

    Published by: Frank Kulash, October 24, 2011 09:40

  • Restrict the range of numbers

    I'm trying to create a form with numeric fields that are supposed to limit the choices that the user can enter.  Here are the choices:

    • null (empty)
    • 1
    • 2
    • 3
    • 4

    The field does not allow the user to enter a 5 or higher.  Once the fields are all completed, I have an estimate at the end than the average of all data.

    I tried to use a drop-down list, but which is in text format, and the calculation at the end of the form does not recognize the characters.

    Help, please!

    I was referring to Acrobat. You never mentioned that you used LC.

    I suggest you post in the forum of LC.

  • How to convert the string with numbers in the table of Boolean 2D

    Hello

    I have input a string with comma separated numbers 1,192 (starting at 1).

    This string must be converted to a table 2D-boolean. Each number that appears should be true, not true rest.

    The 2D table consists of 4 times of 0.47 Boolean values.

    1.48--> [0.47] numbers [0]
    49.96--> [0.47] numbers [1]
    Numbers 97.144--> [0.47] [2]
    145.192--> [0.47] numbers [3]

    If a '1, 49, 97 145' input string put all [0] [0.3] true.

    How can it be easy/fast resolved?

    Thanks for help

    Break the string of numbers in a table of numbers.  (Spreasheet String to Array).

    In a loop For, index with each issue of this table.  Use in the range and Coerce to see if it is in the range of numbers.  (You can put this in a loop For as auto good indexing through the ranges).  If it's in the range, then use subset replace table to activate the corresponding item in a real.  If this is not the case, do nothing.  Maintain the table of Boolean in a shift register.

    Repeat this step for each number in your table.

    (What is a class assignment?)

Maybe you are looking for