Min value is appearing same as Max value

Hi Experts
I am not getting the correct min value in my report, it is displaying the same from max.
Can anyone tell me how to get the min value please.
equipment range
date range
unit of measurement
REPORT Z_ESLP_FUEL LINE-SIZE 200 LINE-COUNT 75
NO STANDARD PAGE HEADING.
TABLES : equi,
equz,
imptt,
imrg,
eqkt,
iloa.
Type Declaration
TYPES: BEGIN OF ty_data ,
        equnr type equnr, " Euipment no
        eqktx type eqkt-eqktx, " Equipment Text
        eqfnr type iloa-eqfnr, " Equipment Sort field
        idate type imrg-idate, " Measuring Date
        recdu type imrg-recdu, " Unit of measuring ='KM','L','H'
        recdv type imrg-recdv, " Counter reading data
      END OF ty_data.
TYPES: BEGIN OF ty_final,
        equnr type equnr, " Equipment no
        eqktx type eqkt-eqktx, " Equipment Text
        eqfnr type iloa-eqfnr, " Equipment Sort field
        min_date type imrg-idate, " Min Date
        min_km type p decimals 2, " Max Km
        max_km type p decimals 2, " Min km
        t_max_min_km type i, " Total min_km-max_km
        max_date type imrg-idate, " Max Date
        min_hr type imrg-recdv, " Max hr
        max_hr type imrg-recdv, " Min hr
        t_max_min_hr type i, " Total min_hr-max_hr
        min_lit type imrg-recdv, " Max lit
        max_lit type imrg-recdv, " Min lit
        t_max_min_lit type i, " Total min_lit-max_lit
        fuel_con type p decimals 2, " Total_hrs / t_max_min_hr
        km_l type p decimals 2, " km / L
        lit_per_hr type i , " fuel comsumed / t_max_min_hr
      END OF ty_final.
DATA: i_data TYPE TABLE OF ty_data, " internal table
      wa_data TYPE ty_data, " work area
      i_final TYPE TABLE OF ty_final, " internal table
      wa_final TYPE ty_final. " work area
data: begin of itab occurs 0,
num type i,
end of itab.
data: v_min_1 type i,
v_max_1 type i,
min like imrg-recdv,
max like imrg-recdv,
max_dt like imrg-idate,
min_dt like imrg-idate,
t_ma_mi type p decimals 2,
V1 LIKE  IMRG-RECDV  ,
V2 LIKE IMRG-RECDV  .
SELECTION-SCREEN BEGIN OF BLOCK blk WITH FRAME.
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: p_equnr FOR equi-equnr ,"no-extension no intervals,
p_idate FOR imrg-idate, "NO-EXTENSION NO INTERVALS OBLIGATORY,
p_recdu FOR imrg-recdu. "NO-EXTENSION NO INTERVALS default 'M3'" OBLIGATORY.
SELECTION-SCREEN END OF BLOCK blk1.
SELECTION-SCREEN BEGIN OF BLOCK blk2 WITH FRAME TITLE text-002.
SELECTION-SCREEN END OF BLOCK blk2.
SELECTION-SCREEN END OF BLOCK blk.
TOP-OF-PAGE.
  FORMAT INTENSIFIED ON.
  WRITE:/1(40) ' INVESTMENT LIMITED '.
  WRITE:/50(40) ' FUEL CONSUMPTION REPORT ' CENTERED ,
  2 'Page', sy-pagno.
  FORMAT INTENSIFIED OFF.
  WRITE:/50(40) '----
' CENTERED .
  FORMAT INTENSIFIED ON.
  WRITE:/2 sy-datum COLOR 3, sy-uzeit .
  "WRITE:/1 S903-SPMON ."p_yearf.
  ULINE.
  "CENTERED.
  write: /2 'Date From :'.
  write: /2 'Equipment No :'.
  write: /2 'Unit :'.
  SKIP.
  ULINE.
  WRITE:/1 sy-vline,
  2 'EQUIP NO', 10 sy-vline,
  11 'NAME', 40 sy-vline,
  41 'min date', 50 sy-vline,
  51 'max date', 60 sy-vline,
  61 'min km', 70 sy-vline,
  71 'max km' , 80 sy-vline,
  81 't_max_min_km', 90 sy-vline,
  91 'min hr', 100 sy-vline,
  101 'max hr', 110 sy-vline,
  111 't_max_min_hr' , 120 sy-vline,
  121 'min lit', 130 sy-vline,
  131 'max lit', 140 sy-vline,
  141 't_max_min_lit', 150 sy-vline,
  151 'fuel con', 160 sy-vline,
  161 'km_l', 170 sy-vline,
  171 'lit_per_hr', 180 sy-vline.
  FORMAT COLOR 3 ON.
  ULINE.
END-OF-PAGE.
START-OF-SELECTION.
  select aequnr deqktx feqfnr eidate erecdu erecdv
  into table i_data
  from equi  AS a
  inner join equz as b
  on aequnr = bequnr
  inner join iloa as f
  on biloan = filoan
  inner join imptt as c
  on aobjnr = cmpobj
  inner join eqkt as d
  on aequnr = dequnr
  inner join imrg as e
  on epoint = cpoint
  where a~equnr in p_equnr
  and
  e~idate in p_idate
  and
  e~recdu in p_recdu.
    LOOP at i_data into wa_data.
         SORT i_data BY  equnr idate descending .
         "Read table i_data into wa_data index 1.
           move wa_data-recdv to max.
         SORT i_data BY  equnr idate ASCENDING .
        "Read table i_data into wa_data index 1.
           move wa_data-recdv to min.
     on change of wa_data-equnr.
     write:/ wa_data-equnr, wa_data-eqktx ,wa_data-eqfnr ,wa_data-idate ,wa_data-recdu ,
     'MAX',max EXPONENT 0 DECIMALS 2,
     'MIN',min EXPONENT 0 DECIMALS 2.  .
     endon.
    endloop.
regards
Piroz

Hi
I have change the logic for this program , I have created 2 workareas and internal table now I need help to place the data into
     wa_final-max_date = wa_data-idate.
         wa_final-min_date  = wa_data-idate.
         wa_final-max_km  = wa_data-recdv.
         wa_final-min_km  = wa_data-recdv.
         wa_final-max_hR   = wa_data-recdv.
         wa_final-min_hR   = wa_data-recdv.
         wa_final-max_lit  = wa_data-recdv.
         wa_final-min_lit  = wa_data-recdv.
         wa_final-t_max_min_km   = wa_data-recdv.  " min_km - max_km
         wa_final-t_max_min_hr  = wa_data-recdv.   " min_hr - max_hr
         wa_final-t_max_min_lit  = wa_data-recdv.  " min_lit - max_lit.
so how can I put the logic to the value please correct my program.seeing my program can anyone give some idea ?
REPORT Z_FUEL_MONTHLY_QTY LINE-SIZE  260 LINE-COUNT 75
         NO STANDARD PAGE HEADING.
TABLES : equi,
         equz,
         imptt,
         imrg,
         eqkt,
         iloa.
Type Declaration
*DATA: BEGIN OF ty_equi occurs 0,
     equnr type equi-equnr,
     END OF ty_equi.
*DATA: BEGIN of ty_eqkt occurs 0,
     equnr type eqkt-equnr,
     eqktx type eqkt-eqktx,
     END OF ty_eqkt.
*DATA: BEGIN of ty_iloa occurs 0,
     iloan type iloa-iloan,
     eqfnr type iloa-eqfnr,
     END OF ty_iloa.
*DATA: BEGIN of ty_imptt occurs 0,
     mpobj type imptt-mpobj,
     END of ty_imptt.
*DATA: BEGIN of ty_imrg occurs 0,
     idate type imrg-idate,
     recdv type imrg-recdv,
     recdu type imrg-recdu,
     END of ty_imrg.
TYPES:  BEGIN OF ty_data  ,
         equnr      type equnr,         " Euipment no
         eqktx      type eqkt-eqktx,    " Equipment Text
         eqfnr       type iloa-eqfnr,     " Equipment Sort field
         idate      type imrg-idate,    " Measuring Date
         recdu      type imrg-recdu,    " Unit of measuring ='KM','L','H'
         recdv      type imrg-recdv,    " Counter reading data
       END OF ty_data.
TYPES: BEGIN OF ty_final,
         equnr           type equnr,            "  Equipment no
         eqktx           type eqkt-eqktx,       "  Equipment Text
         eqfnr           type iloa-eqfnr,       "  Equipment Sort field
         min_date        type imrg-idate,       "  Min Date
         min_km          type p decimals 2,     "  Max Km
         max_km          type p decimals 2,     "  Min km
         t_max_min_km    type i,                "  Total min_km-max_km
         max_date        type imrg-idate,       "  Max Date
         min_hr          type imrg-recdv,       "  Max hr
         max_hr          type imrg-recdv,       "  Min hr
         t_max_min_hr    type i,                "  Total min_hr-max_hr
         min_lit         type imrg-recdv,       "  Max lit
         max_lit         type imrg-recdv,       "  Min lit
         t_max_min_lit   type i,                "  Total min_lit-max_lit
         fuel_con        type p decimals 2,     "  Total_hrs / t_max_min_hr
         km_l            type p decimals 2,     "  km / L
         lit_per_hr      type i           ,     "  fuel comsumed / t_max_min_hr
       END OF ty_final.
DATA: i_data TYPE TABLE OF ty_data, " internal table
wa_data TYPE ty_data, " work area
i_final TYPE TABLE OF ty_final, " internal table
wa_final TYPE ty_final. " work area
DATA :  max_date type date ,
         min_date type date,
         max_km TYPE p DECIMALS 2,
         min_km TYPE p DECIMALS 2,
         max_hr TYPE p DECIMALS 2,
         min_hr TYPE p DECIMALS 2,
         max_lit TYPE p DECIMALS 2,
         min_lit TYPE p DECIMALS 2,
         t_max_min_km  TYPE p DECIMALS 2,
         t_max_min_hr TYPE p DECIMALS 2,
         t_max_min_lit TYPE p DECIMALS 2.
SELECTION-SCREEN BEGIN OF BLOCK blk WITH FRAME.
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: p_equnr FOR equi-equnr, "no-extension no intervals,
                p_idate FOR imrg-idate.  "NO-EXTENSION NO INTERVALS OBLIGATORY,
                "p_recdu FOR imrg-recdu NO-EXTENSION NO INTERVALS ."default 'M3'" OBLIGATORY.
SELECTION-SCREEN END OF BLOCK blk1.
SELECTION-SCREEN BEGIN OF BLOCK blk2 WITH FRAME TITLE text-002.
SELECTION-SCREEN END OF BLOCK blk2.
SELECTION-SCREEN END OF BLOCK blk.
TOP-OF-PAGE.
  FORMAT INTENSIFIED ON.
  WRITE:/1(40) ' INVESTMENT LIMITED  '.
  WRITE:/50(40) ' FUEL CONSUMPTION REPORT ' CENTERED   ,
          2 'Page', sy-pagno.
  FORMAT INTENSIFIED OFF.
  WRITE:/50(40) '----
' CENTERED .
  FORMAT INTENSIFIED ON.
  WRITE:/2 sy-datum COLOR 3, sy-uzeit .
  "WRITE:/1 S903-SPMON ."p_yearf.
  ULINE.
  "CENTERED.
  write: /2 'Date From     :'.
  write: /2 'Equipment No  :'.
  write: /2 'Unit          :'.
  SKIP.
  ULINE.
  WRITE:/1 sy-vline,
    2   'EQUIP NO',              10 sy-vline,
    11  'NAME',                  40 sy-vline,
    41  'SORT',                  60 sy-vline,
    61  'MIN DATE',              74 sy-vline,
    75  'MAX DATE',              87 sy-vline,
    88  'MIN KM',                100 sy-vline,
    101  'MAX KM' ,              113 sy-vline,
    114 'TOTALK',                126 sy-vline,
    127  'MIN HR',               139 sy-vline,
    140 'MAX HR',                152 sy-vline,
    153 'TOTALH' ,               167 sy-vline,
    168 'MIN LIT',               180 sy-vline,
    181 'MAX LIT',               193 sy-vline,
    194 'TOTALL',                206 sy-vline,
    207 'FUEL CON',              219 sy-vline,
    220 'KM L',                  232 sy-vline,
    233 'LIT PER KM',            246 sy-vline.
  FORMAT COLOR 3 ON.
  ULINE.
END-OF-PAGE.
START-OF-SELECTION.
select a~equnr d~eqktx f~eqfnr e~idate e~recdu e~recdv
into table i_data
from equi AS a
inner join equz as b
on a~equnr = b~equnr
inner join iloa as f
on b~iloan = f~iloan
inner join imptt as c
on a~objnr = c~mpobj
inner join eqkt as d
on a~equnr = d~equnr
inner join imrg as e
on e~point = c~point
where a~equnr in p_equnr
and
e~idate in p_idate.
loop  at i_data into wa_data.
CLEAR: wa_final.
  READ TABLE i_final into wa_final
           with key equnr = wa_data-equnr.
    if sy-subrc EQ 0.
      PERFORM prepare_final_rec USING'M'. " Modify Existing Record
     ElSE.
      PERFORM prepare_final_rec USING'A'. " Append New Record.
    ENDIF.
    ENDLOOP.
    LOOP AT i_final into wa_final.
    WRITE:/1 sy-vline,
2  wa_final-equnr                                                 , 10 sy-vline,
11 wa_final-eqktx                                                 , 40 sy-vline,
41 wa_final-eqfnr                                                 , 60 sy-vline,
61 wa_final-min_date                                              , 74 sy-vline,
75 wa_final-max_date                                              , 87 sy-vline,
88 wa_final-min_km EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED           , 100 sy-vline,
101 wa_final-max_km EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED          , 113 sy-vline,
114 wa_final-t_max_min_km EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED    , 126 sy-vline,
127 wa_final-min_hr EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED          , 139 sy-vline,
140 wa_final-max_hr EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED          , 152 sy-vline,
153 wa_final-t_max_min_hr EXPONENT 0 DECIMALS 2  LEFT-JUSTIFIED   , 167 sy-vline,
168 wa_final-min_lit EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED         , 180 sy-vline,
181 wa_final-max_lit EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED         , 193 sy-vline,
194 wa_final-t_max_min_lit EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED   , 206 sy-vline,
207 wa_final-fuel_con EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED        , 219 sy-vline,
220 wa_final-km_l EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED            , 232 sy-vline,
233 wa_final-lit_per_hr EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED      , 246 sy-vline.
ULINE.
endloop.
FORM prepare_final_rec  USING    p_mode TYPE char1.
SORT i_data BY equnr idate descending .
        if wa_data-recdu = 'KM'.
        max_km = wa_data-recdv.
        min_km = wa_data-recdv.
        endif.
        if wa_data-recdu ='H'.
        max_hr = wa_data-recdv.
        min_hr = wa_data-recdv.
        endif.
        if wa_data-recdu ='L'.
        max_lit = wa_data-recdv.
        min_lit = wa_data-recdv.
       endif.
   at new equnr.
       read table i_final into wa_final index sy-tabix.
       write:/ wa_final-equnr, wa_final-eqktx ,wa_final-eqfnr ,wa_final-idate ,
       'Min KM',min_km EXPONENT 0 DECIMALS 2 color 7 ,
        'Min H',min_hr EXPONENT 0 DECIMALS 2 color 7 ,
         'Min L',min_lit EXPONENT 0 DECIMALS 2 color 7.
   endat.
*at end of equnr.
       read table i_data into wa_data index sy-tabix.
       write:/ wa_final-equnr, wa_final-eqktx ,wa_final-eqfnr ,wa_final-idate ,
       'Max KM', max_km EXPONENT 0 DECIMALS 2 color 7,
       'Max H', max_hr EXPONENT 0 DECIMALS 2 color 7,
       'Max L', max_lit EXPONENT 0 DECIMALS 2 color 7.
*endat.
         wa_final-max_date = wa_data-idate.
         wa_final-min_date  = wa_data-idate.
         wa_final-max_km  = wa_data-recdv.
         wa_final-min_km  = wa_data-recdv.
         wa_final-max_hR   = wa_data-recdv.
         wa_final-min_hR   = wa_data-recdv.
         wa_final-max_lit  = wa_data-recdv.
         wa_final-min_lit  = wa_data-recdv.
         wa_final-t_max_min_km   = wa_data-recdv.  " min_km - max_km
         wa_final-t_max_min_hr  = wa_data-recdv.   " min_hr - max_hr
         wa_final-t_max_min_lit  = wa_data-recdv.  " min_lit - max_lit.
  IF p_mode = 'A'.
    wa_final-equnr = wa_data-equnr.
    wa_final-eqktx = wa_data-eqktx.
    wa_final-eqfnr = wa_data-eqfnr.
    APPEND wa_final TO i_final.
  ELSE.
    MODIFY i_final FROM wa_final
      TRANSPORTING
          max_date
          min_date
          max_km
          min_km
          max_hr
          min_hr
          max_lit
          min_lit
          t_max_min_km
          t_max_min_hr
          where equnr = wa_data-equnr.
  ENDIF.
ENDFORM.                    " PREPARE_FINAL_REC

Similar Messages

  • Is there an easy way to make JSpinner wrap around at max/min values?

    I have several pages with a couple dozen JSpinners to set various values - mostly numeric, but some are not.
    I would like to make them wrap around when either the max or min values are reached.
    Is there an easy way to do this?
    I was hoping for something like an "enableWraparound" property, but I haven't found such an animal.
    I suspect I could add value change listeners to all the components and do it by brute force,
    but there are too many spinners scattered around to make that an option I would like to take.
    Any suggestions?
    Thanks.

    Ok, it looks like custom spinner models are the way to go.
    Hopefully, I can create a couple that are generic enough to meet my requirements without too much pain.
    It looks like the ones I have already created will be easy enough to modify.
    Thanks for the feedback.

  • How to find out the max/min value of one field corresponding to a second field in HANA through graphical way.

    Hi,
    I am trying to find out the latest delivery date(EINDT)  for each purchasing document (EBELN) through graphical way.
    The view contains other fields apart from the above mentioned two fields.
    When only the two fields (EBELN, EINDT) are there, then in semantics, I can select 'Max' as aggregation to get the maximum value for each document.
    If I do like this, then I need to join more than 3 views and also so many joins in calculation view. Taking so much time for data preview.
    Hence , please help me in getting the solution while the view contains other fields also.
    Thanks in advance.
    Thanks,
    Jyothirmayi

    Hi Sreehari/Vinoth,
    Thank you for your replies.
    if only two fields are then I can get the max/min values of one field corresponding to other field.
    But more than two fields are there with different values, then let me know how to find out the max/min value of a particular filed corresponding to the 2nd field with other fields also should be in the output.
    I hope you understood my issue.Please revert in case of questions.
    Thanks & Regards,
    Jyothirmayi

  • Query Designer in BI - How to cumulate value and get the Max and Min value.

    I want to create a report with  query designe of BI 7r. is it possible. the data from the cube will be
    Year ,           Exposed Quantity
    1999 ,             200
    2000 ,            100
    2001 ,            -100
    2002 ,             300
    2003 ,           - 200
    2004 ,             100
    2005 ,            -200
    Calculation should be - Refer the cumulative value field
    Year  ,          Exposure Quantity ,   Cumulative value
    1999  ,            200   ,                             200
    2000  ,            100  ,                              300
    2001  ,           -100 ,                               200
    2002  ,            300  ,                              500
    2003  ,          - 200  ,                              300
    2004  ,            100  ,                              400
    2005  ,           -200  ,                              -200
    An the out put of the report  should be Max value ie 500 and Min Value -200.
    My question is that is it possible to do in the front end ie in the Query Designer (BI 7) If so how.
    Edited by: Parakadavil Chacko Mathew on Oct 8, 2009 3:52 AM

    Hi there,
    Create 4 column,
    1st will show regular values for the key figure,
    2nd will show Cumulative value, in Query Designer, Just right click on the this 2nd key figure properties, calculation tab there you can check on Cumulated option, and define the calculation direction as Calculate along the Column.
    3rd will show Minimum value , Just right click on the this 2nd key figure properties, calculation tab calculate single valuea as minimum.
    4th will show Minimum value , Just right click on the this 2nd key figure properties, calculation tab calculate single valuea as Maximum.
    Regards,
    Rajdeep Rane.

  • Get Min value and another column value from the same row

    hi all - for each customer and product, I need to grab the row that has the min value for field Value1. I could've just done group by on customer and product and min on Value1, but I also need to grab Vlaue2 from the same row where the minimum value for
    Value1 lies.
    DECLARE @Temp TABLE (CustomerID INT, ProductID VARCHAR(10), Trans_Date Date, Value1 INT, Value2 INT)
    INSERT INTO @Temp VALUES (123, 'ABC', '1/1/2013', 10, 100)
    INSERT INTO @Temp VALUES (456, 'ASD', '1/1/2013', 40, 500)
    INSERT INTO @Temp VALUES (456, 'ASD', '2/1/2013', 90, 700)
    INSERT INTO @Temp VALUES (123, 'ABC', '2/1/2013', 20, 700)
    SELECT * FROM @Temp
    The output should be
    123, ABC, 10, 100
    456, ASD, 40, 500
    I know that I can just join the table to itself and get the desired output but I am dealing with a table that has millions of rows and I was hoping there is more efficient way to do this. any help would be highly appreciated...

    Here is a correction on your DDL to make it into nearly valid table.
    CREATE TABLE Sales
    (customer_id INTEGER NOT NULL,
    product_id CHAR(10) NOT NULL,
    transaction_date DATE NOT NULL,
    PRIMARY KEY (customer_id, product_id, transaction_date),
    value1 INTEGER NOT NULL,
    value2 INTEGER NOT NULL);
    Here is the current syntax for insertion:
    INSERT INTO Sales
    VALUES (123, 'abc', '2013-01-01', 10, 100),
    (456, 'asd', '2013-01-01', 40, 500),
    (456, 'asd', '2013-02-01', 90, 700),
    (123, 'abc', '2013-02-01', 20, 700);
    WITH
    X
    AS
    (SELECT customer_id, product_id, transaction_date, value1, value2,
    MIN(value1) OVER () AS value1_min
    FROM Sales)
    SELECT X.*
    FROM X
    WHERE X.value1_min = X.value1;
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • Displaying Max/Min values with time for analog signals.

    I am sampling analog inputs. I simply want to display the max and min values with the time they occurred. This seems simple but I am new to LabView and can't find a Vi to do this.

    Here's the code. When you run the demo program, you'll see three traces: Green is the max so far, Red is the min so far, and White is the current signal value.
    As the input value cycles, you'll see the two limit values track its extremes. If you have any questions about how it works, just holler.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps
    Attachments:
    min-max_plotter.vi ‏82 KB
    min-max_tester.vi ‏37 KB

  • Get max and min values from waveform chart

    Hi all
    Ive got a waveform chart and want to display the max and min value for the graph. How do i get the respective values?? Im using LabView 8.2
    holla
    Attachments:
    Untitled 231_LV80.vi ‏23 KB

    Thanks Mike

  • I am a rookie and need help with max and min values

    Hello all, i am into this intro to java class. my assignment is to write a program that prompts the user for two integers and then prints the sum, difference, average, product , distance (absolute value of the difference) Maximum(largest of the two) and Minimum(smallest fo the two) here is my code so far
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.lang.Math;
    public class Sample4
       public static void main(String[] args) throws IOException
          try // attempt the following
    {           // create the stream to read from
    InputStreamReader istream = new InputStreamReader(System.in);   // create a buffer to hold the stream
    BufferedReader console = new BufferedReader(istream);           // prompt the user
          System.out.println("Enter a number please");              // get input as a string
          String input = console.readLine();                        // convert to an integer
          int num1 = Integer.parseInt(input);
          System.out.println("Enter a number please");              // get input as a string
          String input2 = console.readLine();                       // convert to an integer
          int num2 = Integer.parseInt(input2);
          int sum = num1 + num2;                                    // get the sum of the two inputs
          int difference = num1 - num2;                             // get the difference of the two inputs
          int product = num1 * num2;                                // get the product of the two inputs
          int average = sum / 2;                                    // get the average of the two inputs
          int abs = Math.abs(difference);                           // get the absolute value of the two inputs
              // new section
                 // display the number
          System.out.println("The total sum = " + sum);
          System.out.println("The total difference = " + difference);
           System.out.println("The total product = " + product);
           System.out.println("The total average = " + average);
           System.out.println("The total absolute value = " + abs);
    } // if something breaks, catch the exception
    catch (IOException e)
       System.out.println(e); // displays the exception
       System.exit(1);  // quits the program
    }what will be the right syntax or code to find the MAX and MIN values of two numbers a User Inputs, hope someone can help with this. thank you for your help.

    Thanks alot man, sheesh i do not know why my book
    doesnt give me all the static methods. but i do really
    appreciate your help. peaceA complete list of the java.lang.Math methods can be found at http://java.sun.com/j2se/1.4/docs/api/java/lang/Math.html
    btw,
    max(a, b) == (a > b) ? a : b
    min(a, b) == (a < b) ? a : b

  • Max & min value date wise

    I have Table test with columns
    name     value     values_date
    A     40     01/08/2010
    A     10     02/08/2010
    A     10     03/08/2010
    A     10     04/08/2010
    A     20     03/08/2010
    A     50     02/08/2010
    A     50     03/08/2010
    A     50     04/08/2010
    B     100     01/08/2010
    B     10     02/08/2010
    B     20     03/08/2010
    B     10     01/08/2010
    B     100     11/08/2010
    B     100     12/08/2010
    B     100     13/08/2010
    insert into test values('A','40','1/8/2010');
    insert into test values('A','10','2/8/2010');
    insert into test values('A','10','3/8/2010');
    insert into test values('A','10','4/8/2010');
    insert into test values('A','20','3/8/2010');
    insert into test values('A','50','2/8/2010');
    insert into test values('A','50','3/8/2010');
    insert into test values('A','50','4/8/2010');
    insert into test values('B','100','1/8/2010');
    insert into test values('B','10','2/8/2010');
    insert into test values('B','20','3/8/2010');
    insert into test values('B','10','1/8/2010');
    insert into test values('B','100','11/8/2010');
    insert into test values('B','100','12/8/2010');
    insert into test values('B','100','13/08/2010');
    I want OP like
    name     min_value     min_value_date     max_value     max_value_date
    A     10          02/08/2010     50          04/08/2010     
    B     10          01/08/2010     100          13/08/2010

    Santosh.Minupurey wrote:
    Hi.....
    try dis,
    SQL> SELECT A.NAME,A.VALUE,MIN(A.V_DATE),B.VALUE,MAX(B.V_DATE)FROM TEST A,TEST B WHERE
    2  (A.NAME,A.VALUE) IN (SELECT NAME,MIN(VALUE) FROM TEST GROUP BY NAME) AND
    3  (A.NAME,B.VALUE) IN (SELECT NAME,MAX(VALUE) FROM TEST GROUP BY NAME) GROUP BY A.NAME,A.VALUE,B.VALUE;
    NAME            VALUE MIN(A.V_DATE)        VALUE MAX(B.V_DATE)
    A                  10 2/8/2010                50 4/8/2010
    B                  10 1/8/2010               100 13/08/2010Regards,
    Santosh.MinupureyHere is another way using the FIRST and LAST functions
    SQL>select name,
      2  min(value) min_value,
      3  min(v_date) keep (dense_rank first order by value) min_value_date,
      4  max(value) max_value,
      5  max(v_date) keep (dense_rank last order by value) max_value_date
      6  from test
      7  group by name;
    N        MIN_VALUE MIN_VALUE_D        MAX_VALUE MAX_VALUE_D
    A               10 02-AUG-2010               50 04-AUG-2010
    B               10 01-AUG-2010              100 13-AUG-2010For more info, check http://download.oracle.com/docs/cd/B19306_01/server.102/b14223/analysis.htm#i1007059

  • Finding the min value in a hashtable

    Hi,
    I'm trying to work out the lowest value contained in a hashTable. So far I've got.
    import java.util.Enumeration;
    import java.util.Hashtable;
    import java.util.Vector;
    public class StoreValuesDouble extends Statistic {
          * Each object of the class (StoreValuesDouble) will have these attributes.
          * When you call the StoreValuesDouble class you can use
          * myDoubleValues (a Vector holding Double types),
          * Hashtable (a Hashtable using Double types as values and keys) and
          * nullValues (an Double currently set to 0.0).
         Vector<Double> myDoubleValues; //declare a variable myDoubleValues that is of data type Vector
         Hashtable<Double, Double> myValues; //declare a variable myvalues that is a data type Hashtable
         Double nullValues = 0.0; //Double attribute to count the number of null values contained in the vector
          * pass myDoubleValues to inValues
          * @param Vector /<Double/> a vector holding Double values
          * @param inValues the values in the vector
          * @return
         public void DoubleStat(Vector<Double> inValues) {
              myDoubleValues = inValues;
          * calculate the mean of myDoubleValues
          * @return mean of myDoubleValues as a double
         public double meanDouble() {
              double mean = 0;
              Double currentDouble;
              double nonNull = 0;
              for (double j = 0; j < myDoubleValues.size(); j++)
                   currentDouble = myDoubleValues.elementAt((int) j);
                   if (currentDouble != null) {
                        mean += currentDouble.doubleValue();
                        nonNull++;
              return mean / nonNull;
          * calculate the standard devitation of myDoubleValues
          * @return standard devitation of myDoubleValues as a double
         public double standardDeviationDouble() {
              double m = meanDouble();
              double t = 0.0;
              Double currentDouble;
              double n = 0;
              for (double j = 0; j < getDoubleValues(); j++) {
                   currentDouble = myDoubleValues.elementAt((int)j);
                   if (currentDouble != null) {
                        n = currentDouble.doubleValue();
                        t += (n - m) * (n - m);
              return Math.sqrt(t / (myDoubleValues.size() - 1.0));// n - 1 as sample varience
          * return the number of values of myDoubleValues to help calculate the mean & standard deviation
          * @return the size of myDoubleValues as a Double
         public double getDoubleValues() {
              return myDoubleValues.size();
          * compute the number of null values
          * @return a double value representing the number of null values
         public Double getDoubleNull() {
              Double nbNull = 0.0;
              // test if myIntValues is null
              if (myDoubleValues == null) {
                   System.out.println("Please enter values that are not null!");
                   return 0.0;
              // if not null, parse all values
                   // for each value, test if it is null or not
                   Double currentDouble;
                   for (double i = 0; i < myDoubleValues.size(); i++) {
                        currentDouble = myDoubleValues.elementAt((int)i);
                        if (currentDouble != null) {
                             /// nothing to do
                        else {
                             nbNull++;
              return nbNull;
    //find the MIN values in the Hashtable to give us the range (with the MAX value)
         public Double MinDouble()
              Double MinDouble = null;
              Double currentValue;
              for (double j = 0; j < myDoubleValues.size(); j++)
                   currentValue = myDoubleValues.elementAt((int) j);
                   if (currentValue != null){
                   if (currentValue <= MinDouble) {
                        MinDouble = currentValue;
              return MinDouble;
         /*find the MAX value in the Hashtable to give us the range (with the MIN value)
         public double MAX()
          * Create an instance of StoreValuesDouble to hold vector values and number of times the values
          * appear. StoreValuesDouble automatically contains the variables defined above
          * (myDoubleValues, myValues and nullValues) we have to initialise myDoubleValues and myValues
          * as they have been defined but not initialised. nullValues has been defined (int) and initialised (0).
          * @param Vector /<Double/> a vector holding Double values
          * @param inValues the values in the vector
          * @return
         public StoreValuesDouble(Vector<Double> inValues) {
              myDoubleValues = inValues; //the attribute myDoubleValues defined in the StoreValuesDouble class
              //is the inValues parameter, this allows us to store the Vector in inValues
              myValues = new Hashtable<Double, Double>(); // create an instance of/initialise Hashtable
          * Now define the methods to make the instance StoreValuesDouble do what we want it to do
          * (ie parse all the double values of the myDoubleValues Vector attribute.
         public void computeDoubleValues() {
              Double currentDouble;//local variable to store the current read Double object
               * Use a for loop to read through all the values contained in the vector
              for (double i = 0; i < myDoubleValues.size(); i++) {
                   currentDouble = myDoubleValues.elementAt((int)i);
                   //currentDouble is now the Double object stored at i
                   //to check that i is not null we use the if statment
                   if (currentDouble != null) {
                        //i is not null so we want to add it to the hashtable. Rather than writing a lot of code
                        //here to do checking and adding we just call a method that can be written seperately
                        updateDoubleTable(currentDouble);
                   else {
                        //i is null so we just count it by adding it to our nullValues attribute
                        nullValues++;
          * Update the current distribution of Doubles
          * @param Double for the value of the key
          * @param inDouble for the value entered into the Hashtable (the object)
         public void updateDoubleTable(Double inDouble) {
              //First test that variable inDouble is not null
              if (inDouble != null) {
                   //update the table myValues this involves two tasks
                   //1)see if the double object has already been seen
                   //so we create a local variable to test the Hashtable
                   boolean alreadyPresent;
                   alreadyPresent = myValues.containsKey(inDouble);
                   //here we check whether inDouble is already in myValues
                   if (alreadyPresent) {
                        //if it is present we need to increase the counter
                        Double counter = myValues.get(inDouble);
                        //local variable counter to get the value associated to the key inDouble
                        Double newCounter = new Double(counter.intValue() + 1.0);
                        //update counter values and then ...
                        myValues.put(inDouble, newCounter);
                        //put into myValues
                        //as Hashtable can store only Objects, we cannot use primitive types
                        // so we use Objects related to primitive types as Integer, Float, Double
                        // or Boolean (here, we use Double)
                   } else {
                        //store the double and set it's counter to 1
                        myValues.put(inDouble, new Double(1));
              } else {
                   //do nothing
         //now we want to display the values
         public void displayDoubleTable() {
              // to display the distribution, we need to parse all the keys of the
              // hashtable and access to the value associated to each key
              Enumeration<Double> keys = myValues.keys();
              Double currentKey;
              Double currentValue;
              System.out.println("");
              System.out.println("Hashtable Information:");
              System.out.println("");
              System.out.println(myDoubleValues.size() + " Double objects in initial vector");
              System.out.println("");
              while (keys.hasMoreElements()) {
                   currentKey = keys.nextElement();
                   currentValue = myValues.get(currentKey);
                   System.out.println("The value " + currentKey.doubleValue()
                             + " has been seen " + currentValue.doubleValue()
                             + " time(s) in the initial Vector");
              System.out.println("");
              System.out.println("There were " + nullValues
                        + " null Double object(s) in the inital Vector");
         }As part of the StoreValuesDouble class. And to display it.
    package statistics;
    import java.util.Vector;
    public class TestStatDouble {
         static Vector<Double> doubleVector;
          * Create and initialise a vector of values and compute the mean,
          * standard deviation, distribution and MIN/MAX values.
         public static void main(String[] args) {
               // initialise the values in initValues
              initValues();
              // create an instance of StoreValuesDouble taking double as the parameter
              StoreValuesDouble is = new StoreValuesDouble(doubleVector);
              //Display the results
              displayVectorContent(doubleVector);
              System.out.println("");
              System.out.println("Number of null values: " + is.getDoubleNull());
              System.out.println("Number of non-null values is: " +(is.getDoubleValues() - is.getDoubleNull()));
              System.out.println("Number of all values: " + is.getDoubleValues());
              System.out.println("The mean is: " + is.meanDouble());
              System.out.println("Standard deviation is: " + is.standardDeviationDouble());
              System.out.println("The lowest value is " + is.MinDouble());
              System.out.println("");
               * now I want to display the results from the displayTable method in the StoreValuesDouble
               * class so I create an instance of StoreValuesDouble and use the computeDoubleValues and
               * displayDoubleTable methods.
              StoreValuesDouble storeValues = new StoreValuesDouble(doubleVector);
              storeValues.computeDoubleValues();
              storeValues.displayDoubleTable();
          * create the class method initValues() to add values to the Vector doubleVector
         public static void initValues()
              doubleVector = new Vector<Double>();
              doubleVector.addElement(null);
              doubleVector.addElement(new Double(10.9));
              doubleVector.addElement(new Double(15.95));
              doubleVector.addElement(new Double(17));
              doubleVector.addElement(null);
              doubleVector.addElement(new Double(1));
              doubleVector.addElement(new Double(4));
              doubleVector.addElement(new Double(10.499));
              doubleVector.addElement(null);
              doubleVector.addElement(new Double(10.4999));
              doubleVector.addElement(new Double(17));
              doubleVector.addElement(new Double(-15));
              doubleVector.addElement(null);
              doubleVector.addElement(new Double(14));
              doubleVector.addElement(new Double(20));
              doubleVector.addElement(new Double(-3));
              doubleVector.addElement(null);
              doubleVector.addElement(new Double(9));
              doubleVector.addElement(new Double(1.5));
              doubleVector.addElement(null);
              doubleVector.addElement(new Double(10.22));
              doubleVector.addElement(new Double(15.23));
              doubleVector.addElement(new Double(17.91));
              doubleVector.addElement(null);
          * class method to print values contained in the vector doubleVector to the console.
          * @param doubleVector the Vector to be displayed
         public static void displayVectorContent(Vector doubleVector)
              Double currentDouble;
              System.out.println("Double values within the Vector:");
              for (int i=0; i<doubleVector.size();i++)
                   try
                        currentDouble = (Double) doubleVector.elementAt(i);
                        if (currentDouble != null)
                             System.out.print(currentDouble.toString() + " ");
                   catch(ClassCastException cce)
                        System.out.print(cce.getMessage() + " ");
                        cce.printStackTrace();
              System.out.println("");
         It compiles fine but when I try and run it I get a
    Exception in thread "main" java.lang.NullPointerException
         at statistics.StoreValuesDouble.MinDouble(StoreValuesDouble.java:139)
         at statistics.TestStatDouble.main(TestStatDouble.java:37)
    TestStatDouble 37 is
    System.out.println("The lowest value is " + is.MinDouble());139 is
    if (currentValue <= MinDouble) {I guess the problem's in my if loop but I'm not sure why. Any help would be appreciated.
    Message was edited by:
    Ali_D

    Couple of points about your code:
    1. Don't declare your instance variables as solid types, declare them using their interfaces (where applicable), so in your case don't specifiy that you are using Vector or Hashtable, use List and Map. This will allow you to easily change your code to use a different collection, if and when appropriate. Also the unnecessary overhead of Vectors synchronisation means that you should use ArrayList instead of vector (that means that you will have to use get(int) instead of elementAt() but that's a very small price to pay.
    2. Declare local variables as close to their point of usage as possible. (Unless you need to do this for your course work, in which case you don't have a choice).
    3. Use the appropriate data type. For your count of null values you should be using an int or a long (you can't have a fractional count value!) Also, this should have been obvious to you, when you had to cast the value to an int for use with your lists. (Using double as an index is a very bad idea... And before you go posting the question, do a search on why floating point precision may not give you the results you expect)
    4. Code defencively... e.g. in your meanDouble() method, you set nonNull to 0, and then you do a division using that value. What do you think is going to happen if your loop doesn't execute once? Division by zero... You should handle these cases, rather than letting them fail ignominiously.
    5. If you are doing code like this...    if (currentDouble != null) {
            // / nothing to do
        } else {
            nbNull++;
        } Why have the empty block? You should just do the inverse.
        if (currentDouble == null) {
            nbNull++;
        } Far simpler, and expresses exactly what you are trying to do, not what you are not trying to do.
    6. Enumeration --- What version of java is that course being run in? I can see that you are using autoboxing, so it has to be 1.5 so, WHY is your lecturer encouraging the use of Vectors, Hashtables, and Enumerations!?!?!
    Anyway, that should be enough to be going on with.

  • Update a table based on Min value of a column of a Another Table.Pls Help.

    Dear All,
    Wishes,
    Actually I need update statement some thing like below scenario...
    Data in table is like below:
    I wrote a query to fetch data like below ( actually scenario is each control number can have single or multiple PO under it ) (i used rank by to find parent to tree like show of data)
    Table: T20
    Control_no        P_no  Col3
    19950021     726473     00
    19950036      731016     00
    19950072     731990     00
                     731990 01
    19950353     734732     00
                     734732 01
    19950406     736189     00
                 736588     01
                 736588     02
                 736588     03                
    Table : T30
    Control_no      P_no              col3
    19950021     726473 
    19950036     731016
    19950072     731990     
                 731990     
    19950353     734732     
                  734732     
    19950406     736189     
                  736588     
                  736588     
                   736588     
      Now requirement is I need to update Table T30's col3 (which do have values in T20 but not this table) in such a way that , It should take MIN (COL3) from T20 and then update that value to related Col3)
    Better I can explain through below new data format in T30 after update:
    After update it should like:
    Table : T30
    Control_no       P_no    col3 (this is updated column)
    19950021     726473   00  -- as this is min value for Pno 726473 belongs to Control NO 199950021 in Table T20 above
    19950036     731016   00  -- as this is min value for Pno 726473 belongs to Control NO 199950021 in Table T20 above
    19950072     731990   00  -- see here..both Pno should updated as '00' as MIN value col3 in Table T20 related to this
                 731990      00     record is '00'  (out of 00,01 it should select 00 and update that value here)
    19950353     734732      00  -- same again both Pno should updated as '00' as MIN value col3 in TableT20 related to this
                 734732      00     record is '00'  (out of 00,01 it should select 00 and update that value here)
    19950406     736189      00  -- As there is single col3 value in T20, 00 should be updated here.
                 736588      01  --  Here it should update col3 as '01' since for this pno(736588)
                 736588      01  --  Here too it should update col3 as 01 per requirement ,minimum value of this pno in T20
                 736588      01  --     same here too.. Sorry if my post formatting is not good...
    Hope i am clear in my requirement..(update T30 col3 based on min value of col3 of related records)
    Please suggest some update sql for this...(ideas would be great)
    I am using oracle 10 g version soon will be migrated to 11g..
    Regards
    Prasanth
    Edited by: Onenessboy on Oct 20, 2010 12:13 PM
    Edited by: Onenessboy on Oct 20, 2010 12:15 PM

    Onenessboy wrote:
    I am really sorry, my post so nonsense in look..
    I used to use for actuall code..
    the out put i tryped, i used [pre] , [/pre] but still does not look good..
    hmm..thanks for your suggestion hoek..
    so any ideas about my requirement...I would suggest spending a bit more time trying hoek's suggestion regarding {noformat}{noformat} tags instead of repeatedly asking for more help.
    Because to understand your requirement, people are going to have to read it first.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Read a txt file, display a table of values, select a value to set min value for DAQMX

    Hello everyone, I am having trouble with the following data importing. I want to do the following:
    Open a txt file, have it be imported as a table. Allow the user in the GUI to select a value on the 2nd column, set that value as either min or max for a daqmx analog output. I'll attach the .txt file being used. I can add the code but I was basically using the read from text.vi example with no luck.
    Attachments:
    090414-200-800-16x.txt ‏1 KB

    Thank you all, I have set up this input but I have a couple more questions. First now that I have the ability to have a mouse click to set a value, is it possible to have two events, such that the first sets a certain value and the second retains a different one?
    In addition (im not sure if this would be ok to post here but for the sake of clarity and decluttering the forum I shall post it here) is it possible to switch from a constant voltage mode (in DAQMX analog output) to a waveform mode ( attacthed the binary waveform) all while maintaining a constant min value (untill updated from the table by user, which is also attached).
    I have attachted a vi (Labview version 8.2) that I threw together today.
    Thank you all,
    DB
    Attachments:
    calib.csv ‏3 KB
    Example.vi ‏157 KB

  • Result row shows min. value as Blank.

    Hi Guru,
    I have following scenario in query,
    Eg.
    1.Values in objects in column,                           10,000
                                                                            Blank (no value)
                                                                            2,000
                                                                            Blank(No value)                     
    Result Row  shows                                         Blank (instead of 2,000)
    2. Values in same object in same column           10,000    
                                                                            2,000
                                                                            3,000
                                                                            1,000
    Result row shows                                          1,000 (which is Correct one)
    If value in column is blank then it is showing me minimum value as blank but in real it has to display min of all row, second if row  is not blank then it is showing correct min. value in result row (As mentioned in second examlp)
    Please suggest me what i have to do to get exact min. of  all values in Result row.
    Thanks,
    Ganesh.

    hi all,
    Thanks for contribution.
    But i want min. values from all rows in my result row.if it is not suppresed by Zero then also it hase to display min value (I MEAN fIGURE LIKE 2,000) from row.
    if i do supress Zero then it is diplaying as Blank hense all resulti row is display blank but i dont want that i want if row value is Zero or Blank it will display as min. of all figure NOT ZERO OR BLANK LIKE ABOVE EXAMPLE IT IS 2,000.
    Thanks,
    Ganesh.

  • HOW TO SELECT MIN VALUE UNDER DEFAULT TAG OF SELECT LIST

    GREETINGS,
    I M USING APEX 4.1 AND CREATED SELECT LIST ON PAGE, I WANT TO SHOW MIN VALUE OF THE SELECT LIST FOR THAT I WROTE IN THAT SELECT LIST PROPERTIEC UNDER DEFAULT TAG MIN; AND CHOOSE PL/SQL EXPRESSION BUT ITS GIVING ERROR "Error computing item default value for page item P1_PRODUCT."
    BUT IF I HARCORE THE VALUE CONTANING IN MY DATA LIKE PRODUCT ID = 1, I HARDCODED IN DEFAULT VALUE 1 AND SELECT PL/SQL EXPRESSION IT WORKS.
    BUT ITS NOT DONE LIKE THIS I WANT TO SELECT BY DEFAULT MIN VALUE OF THE SELECT LIST, SO THAT THE DATA SHOULD BE DISPLAYED ACCORDING TO THAT.
    THE EXACT REQUIREMNT IS TO ENTER THE SELECT LIST DEFULAT VALUE IN SESSION SO THAT DATA IS TO BE DISPLAYED

    Hi,
    you have some options:
    1) you can try setting default value of P1_SELECT_PRODUCT item, I was do it
    2) or you can try send the value of P1_SELECT_PRODUCT value in URL, like this:
    http://apex.oracle.com/pls/apex/f?p=45296:1:0::::P1_SELECT_PRODUCT:4
    3) or you can set the session state of P1_SELECT_PRODUCT item on page 101 (login page) by seting this value in Login process on page 101
    HELLO kIAS !
    SETTING DEAFULT VALUE VALUE OF P1_SELECT_PRODUCT_ITEM IS NOT A SOLUTION ON THIS MATTER, BECASUE P1_SELECT_PRODUCT IS CALLED DYNAMICALY AFTER THE LOGIN DEPEND UPON THE RIGHTS OF THE USER THE SELECT IS POPULATED ID USER IS E.G ABC AND IT DOESBNOT CONTAIN SELECT LIST VALUE 4 THEN IT DISPLAY NOTHING.
    AND THIRD POINT MAY BE HELP ME BUT I DONT KNOW HOW TO SET SESION STATE BECASUE WHEN I GO TO LOGIN PAGE AND CREATE SESSION STATE PROCESS FOLLOWING RADIO BUTTOPN APPEARS
    Clear Cache For Applications (removes all session state for listed applications)
    Clear Cache For Current Application (removes all session state for current application)
    Clear Cache For Current Session (removes all state for current session)
    Clear Cache for Items (ITEM,ITEM,ITEM)
    Clear Cache for all Items on Pages (PageID,PageID,PageID)
    Reset Preferences (remove all preferences for current user)
    Set Preference to value of Item (PreferenceName:ITEM)
    Set Preference to value of Item if item is not null (PreferenceName:ITEM)
    WHICH ONE I HAVE TO SELECT ?

  • Multidimensional NSArray: How to find min value with valueForKeyPath ?

    Hi,
    I've setup a multidimensional NSArray with columns and rows. The data is read from a file and are float values.
    I can easily access the data like this:
    NSLog(@"Row[0][0] %f", [[[rows objectAtIndex:0] objectAtIndex:0] doubleValue] );
    NSLog(@"Row[0][1] %f", [[[rows objectAtIndex:1] objectAtIndex:0] doubleValue] );
    NSLog(@"Row[0][2] %f", [[[rows objectAtIndex:2] objectAtIndex:0] doubleValue] );
    etc.
    However I don't know how to get the min/max values for a column in a 2 dimensional NSArray.
    With a simple NSArray it's easy to retrieve the min/max value:
    NSArray *array = [NSArray arrayWithObjects:[NSNumber numberWithInt:16], [NSNumber numberWithInt:4], [NSNumber numberWithInt:128], nil);
    NSLog(“Min value : %@", [array valueForKeyPath:@"@min.intValue"]);
    Now, does someone know how to retrieve min/max values with valueForKeyPath: ?
    Any help is greatly appreciated.
    Cheers,
    Gilles

    #import <Foundation/Foundation.h>
    int main (int argc, const char * argv[]) {
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
    NSMutableArray * array = [[NSMutableArray alloc]init];
    NSMutableArray * another = [[NSMutableArray alloc]init];
    NSNumber * num1 = [NSNumber numberWithFloat:1.1];
    NSNumber * num2 = [NSNumber numberWithFloat:1.2];
    NSNumber * num3 = [NSNumber numberWithFloat:1.3];
    [another addObject:num1];
    [another addObject:num2];
    [another addObject:num3];
    [array addObject:another];
    NSLog(@"%@",[[array objectAtIndex:0] valueForKeyPath:@"@min.floatValue"]);
    [another release];
    [array release];
    [pool drain];
    return 0;
    Maybe I'm not 100% clear on the question your asking, but doesn't the above code get the min(or max if you wanted) value for the second array

Maybe you are looking for

  • How to find out the Streaming speed of a flash player?

    Hi guys! I am Testing web site which is having a flash video files. if I select an video file, it will open a new  window and play the video. now I want to find out the video player in which band with using to play with out any buffering. Actually ou

  • Itunes will not open safari webkit2 error... :(

    all of a sudden my itunes will not open... i've folllowed ALL of the steps to fix it... no results... my safari keeps giving me a webkit2process.exe error and quicktime does not work!!! help!!!! 

  • DataGrid update cell event generated twice

    Hi all, We are trying to create an editable cell in a datagrid, and in the itemEditEnd method to display an error message if the new value introduced is incorrect. The problem here is that the event is always generated twice. Do you know what could c

  • CP 8.0.1 - video

    Hi everybody. I have these problems: Project contains: 1. Video included to slide  (FLV) 2. Linked video to Youtube widget. After publishing content as SWF and played locally - slide video plays normaly, youtbue widget not After uploading the same co

  • Alert Message When Data Load Fails

    Hi Friends, I have three process chains(p1,p2,p3)and all for transactional data loading(psa-ods-cube).suppose whenever data load fails,it sends message to my company mail id. is there any functionality to do like this. i am not much aware of RSPCM(Pr