How to count values in a query ?

Hi experts,
We have a query, which is having only characteristics. There are no key figures.
There is date field. In this date field the value may be or may not be there.
My requirement is if the date field has value then it should be counted record wise and the total count
should be displayed in the bottom of the query output. If value is not there then that record should not be
counted.
How can we do this ?
Regards,
Nishuv.

Dear Nishuv,
You can create a calculated keyfigure for getting count, in that create a formula variable on characterstic with replacement as processing type.
and please clarify  on what level you wanted to count, like Sales Docuement level or Item level.
For Example :
If you wanted to find no.of sales orders which are returned so  you have to count on document level. this would be the replacement characterstic.
Please find the below PDf  you will understand better
https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/009819ab-c96e-2910-bbb2-c85f7bdec04a
Thanks
Sreekanth

Similar Messages

  • How to count number in the query?

    Hi all;
    I have four key figure in the row,the values for the key figure  may be zero or null or  availability values,I want count the number for zero and availability values.How to do ?
    Thanks.

    Hi,
    Use Count Data function in Formulas...
    Eg: KeyFigure = Sale, then create Formula Count(Sale)
    See the Data Functions
    Value = 1, if operand <> 0, otherwise 0 (counter) COUNT
    Thanks
    Reddy

  • How to count values by using cursor

    HI,
    I want to check column is empty or filled. and i should use cursor not indipendent SQL query. I written my programe like this. but count(cursor.columnname) not taken how can i do this. please help me.
    declare
    cursor c_rec is select *from ppc_input_file;
    begin
    FOR c_rec IN c1 LOOP
    dbms_output.put_line('@@@@' || c_rec.device_name);
    IF COUNT(c_rec.ppc_method) THEN
    dbms_output.put_line('hihihh');
    ELSE
    dbms_output.put_line('nononono');
    END IF;
    END LOOP;
    venkat.

    Hi,
    Please go through the pl/sql docs carefully before you start writing codes.
    Please follow the link and read first.
    http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261.pdf
    declare
    cursor c1 is select * from ppc_input_file;
    This was wrongly written as cursor c_rec is select *from ppc_input_file;.
    begin
    FOR c_rec IN c1 LOOP
    dbms_output.put_line('@@@@' || c_rec.device_name);
    The following bold portion is unnecessary. If the count is zero the cursor for loop will not run. I am not sure of your requirement.
    --IF COUNT(c_rec.ppc_method) THEN
    --dbms_output.put_line('hihihh');
    --ELSE
    --dbms_output.put_line('nononono');
    --END IF;
    END LOOP;
    end;
    regards,
    Dipankar.

  • How to count values being outputted ?

    I have a loop running through a DB and the program outputs values such as below to the screen, where the first character is varied it can be any value (eg ABC WON, or XYZ LOST) , and the output can also be of varying lengths.
    How could the program count up the number of wins etc for each one e.g. output D Won 1, A Lost 2, A Won 1, A Drawn 1 etc
    D WON
    A LOST
    C WON
    A LOST
    A DRAWN
    B DRAWN
    B WON
    D LOST
    C WON
    B LOST
    A WON
    D LOST
    I tried using an array but could not get it to work, ideas would be v. appreciated,
    thanks
    (sorry for the caps but thats output of the program ;) )

    Create a class Team which contains Name, Wins, Losses.
    Use a Map to store the instances of Team, the Key being the team name, the value being the Team instance.
    Whenever you want to update the teams win/loss record, ask for the team by name from the map.
    If it returns null, create and add a new team.
    If it returns a Team, simply update the Team instance.

  • How to get values from a query string in URL in a jsf page?

    if i have a url, http://my.com/?name=john+smith, how do i get the values from that url in a jsf page and then pass those values to a servlet?
    i know how to do that in jsp using "request.getParamter("name")" and save it in a bean and then forward to a servlet. But what about in jsf?

    Hello,
    Try this:
    Map requestMap = FacesContext.getCurrentInstance().getExternalContext().getRequestMap();
    String name = (String) requestMap.get("name");If isn't worked one of these methods probably will solve your problem.
    FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
    FacesContext.getCurrentInstance().getExternalContext().getRequestHeaderMap();hth.

  • How to exclude values in the query designer

    Hi everybody,
    i need your help!
    I need to exclude certain information from a report, but as could enter new values in the future, I see it now.
    Ex.
    CreatedBy contains the following values:
    MSanz
    PRojas
    Soporte
    Soporte1
    Soporte2
    I need to exclude anything value that is Soporte* for first report
    and the second report include anything value Soporte*
    first report
    MSanz
    PRojas
    Second Report
    Soporte
    Soporte1
    Soporte2
    thanks for your help
    Manuel
    Edited by: Manuel Sandoval on May 30, 2008 6:35 PM

    Hi Manuel,
    There are two ways to exclude the fields of Createby.
    1. Excude Soporte,Soporte1,Soporte2 in the first report.  Select createby -->, right click >Restrict> select  Soporte,Soporte1,Soporte2  and pull from left to right > right click(3 fields)> exclude.
    Similary for second report exclude MSanz, PRojas.
    Or
    After restricting include only the necessary fvalues  from right to left for creteby field.
    Best method is include one, for performance point of you.
    Second approach is create two user exit variables. one to include Soporte,Soporte1,Soporte2 (3 values) in the variable and second variable to include MSanz, PRojas. You can maintain these two variables values in the tvarvc table and use these variable  in the reports directly. This approach is very very useful if you want to use this variable in many reports ex, 10 or more. Directly you can drag createby and its corresponding variable.
    Choose the best approach for your requirement.
    Hope it helps.
    (assign me points)
    Thanks
    Lasya.

  • Urgent : JDBC How to Count Values in result set.

    Hi all,
    How can i find the size of ResultSet i.e. The number of records returned by a select statement.
    Thanks in advance.
    Abhishek

    int nb = 0;
    while (rs.next())
    nb++;

  • How to write multi row sub query with the row containing range of values?

    Hi all,
    I have to include a column which contains weight ranges and it should come fom table called "report_range_parameters"
    The following query will reutrn those weight ranges.
    select report_parameter_min_value || ' -> ' || report_parameter_max_value
              from report_range_parameters
             WHERE report_range_parameters.report_parameter_id = 2359
               and report_range_parameters.report_parameter_group = 'GVW_GROUP'
               and report_range_parameters.report_parameter_name  = 'GVW_NAME'
                        The below query should return the values group by those weight ranges.
    How could I write that sub query?
    select   SUM(NVL("Class 0", 0)) "Class 0"  ,
                SUM(NVL("Class 1", 0)) "Class 1"  ,
                SUM(NVL("Class 2", 0)) "Class 2"  ,
                SUM(NVL(" ", 0)) "Total"
         FROM (
                 SELECT report_data.bin_start_date_time start_date_time,
                        SUM(DECODE(report_data.gvw, 0, report_data.gvw_count, 0)) "Class 0" ,
                        SUM(DECODE(report_data.gvw, 1, report_data.gvw_count, 0)) "Class 1" ,
                        SUM(DECODE(report_data.gvw, 2, report_data.gvw_count, 0)) "Class 2" ,
                        SUM(NVL(report_data.gvw_count, 0)) " "
                  FROM report_data
                 GROUP BY report_data.bin_start_date_time
              ) results
       RIGHT OUTER JOIN tmp_bin_periods
                     ON results.start_date_time >= tmp_bin_periods.bin_start_date_time
                    AND results.start_date_time <  tmp_bin_periods.bin_end_date_time
               GROUP BY tmp_bin_periods.bin_start_date_time,
                        tmp_bin_periods.bin_end_date_time Thanks.
    Edited by: user10641405 on Jun 15, 2009 3:14 PM
    Edited by: user10641405 on Jun 15, 2009 3:17 PM

    Hi,
    Assuming the following 4 things:
    (1) report_range_parameters contains data like this, from your [previous thread|http://forums.oracle.com/forums/message.jspa?messageID=3541079#3541079]
    id  group      name         min_value      max_value
    1   gvw_group  gvw_name      0              5
    2   gvw_group  gvw_name      5              10
    3   gvw_group  gvw_name     10              15(2) max_value is actually outside the range (that is, a value of exactly 5.000 is counted in the '5->10' range, not the '0->5' range)
    (3) the range has to match some column x that is in one of the tables in your main query
    (4) You want to add that column x to the GROUP BY clause
    then you shopuld do somehting like this:
    select   SUM(NVL("Class 0", 0)) "Class 0"  ,
                SUM(NVL("Class 1", 0)) "Class 1"  ,
                SUM(NVL("Class 2", 0)) "Class 2"  ,
                SUM(NVL(" ", 0)) "Total"
    ,         report_parameter_min_value || ' -> ' || report_parameter_max_value     AS weight_range          -- New
         FROM (
                 SELECT report_data.bin_start_date_time start_date_time,
                        SUM(DECODE(report_data.gvw, 0, report_data.gvw_count, 0)) "Class 0" ,
                        SUM(DECODE(report_data.gvw, 1, report_data.gvw_count, 0)) "Class 1" ,
                        SUM(DECODE(report_data.gvw, 2, report_data.gvw_count, 0)) "Class 2" ,
                        SUM(NVL(report_data.gvw_count, 0)) " "
                  FROM report_data
                 GROUP BY report_data.bin_start_date_time
              ) results
       RIGHT OUTER JOIN tmp_bin_periods
                     ON results.start_date_time >= tmp_bin_periods.bin_start_date_time
                    AND results.start_date_time <  tmp_bin_periods.bin_end_date_time
       LEFT OUTER JOIN  report_range_parameters                                        -- New
                    ON  x >= report_parameter_min_value                                    -- New
              AND x <  report_parameter_max_value                                   -- New
                    AND report_range_parameters.report_parameter_id = 2359                         -- New
                    and report_range_parameters.report_parameter_group = 'GVW_GROUP'               -- New
                    and report_range_parameters.report_parameter_name  = 'GVW_NAME'                    -- New
               GROUP BY tmp_bin_periods.bin_start_date_time,
                        tmp_bin_periods.bin_end_date_time
                  , x                                                       -- New

  • How to get counter value from Historian

    Hi Experts,
    We have got a scenario to keep the number (counter) to see how many time a value of tag have been changed.
    For Example:
    If the values change from 1 to 0 and  0 to 1 for 25 times in a minute. We would like to get this number (25) from Historian (Wonderware).
    Currently we are not using any Pco to fetch the value from Hisotrian since we are able to fetch the tag values from Historian database through SQLConnection.
    I would like to know if we introduce Pco, will that help us to get this counter value.
    We are working on MII 15.0 version.
    Any help of this very much appreciated.
    Thanks
    Shaji

    Hi Shaji,
    PCo OPC DA does not support  PCoQuery TagAggregateMode as it only has access to Current Values of OPC Tags, because OPC DA only provides Current Value access.
    I know it is possible to execute SQL queries against the Wonderware Historian to retrieve counts aggregates, but don't have the details handy. Recommend that you deploy the InSQLPCo Data Server in MII and try using the PCoQuery TagAggregateMode method to retrieve the Counts aggregate first.
    Regards, Steve

  • How to get counter values from pci 6221 card?

    Hii
     I am using PCI 6221 card .. In that i am using the ctr o .. In my application i am using Linear encoder to measure the Lift movement.. so from software how to access the counter values i.e how much mm it moves... 

    Measure Angular Position.vi in the LabVIEW examples will be a good starting point. Adapt it to Linear Encoder by clicking on the selector below DAQmx Create Channel.vi.
    You can also create a corresponding DAQmx Global Channel (or task) in MAX and then use it in your code.
    Feel free to post back if you need further help.
    Message Edité par JB le 10-31-2008 02:15 PM

  • How to get the max value in the query??

    Plant  calday(mm.dd.yyyy)       Soldout.Qty
    0001   01.01.2005               10
    0001   01.02.2005               20
    0001   01.03.2005               05
    0001   01.04.2005               16
    0001   01.05.2005               10
    0001   01.06.2005               14
        From the above values , how can i findout Max(Soldout.Qty)(i.e 20) for the above week...Suppose present aggregation = summation...How can i findout the value in the Query??don't want to do changes to design...

    Hi Bhanu,
      I tried the calculation results as...Maximum,..
      But that will pick the maximum value among the avialable values..like
    plant1 max 10
    plant2 max 20
    plant3 max 30
    then it will show as..
    plant1 max 30
    plant2 max 30
    ...like this...but my case is
    plant1 calday1 10
    plant1 calday2 05
    plan1  calday7 08
    plant2 calday1 10
    plant2 calday2 05
    plan2  calday7 20
    so for each set it need to bring the maximum value...

  • How to count no of records returned from a query?

    Hello,
    I need to find out how many records displayed from a query without writing any other queries.
    i mean that.
    I have a query such as:
    query = "select * from users";
    and the resultset for it is rs.
    and i need to display how many records fetched from this query without using any other query such as "select count(user_id) from users" etc.
    Is there any function ?

    No, unfortunately there is no method or property that will tell you how many rows have been returned by a query.
    People use many different techniques.
    1.The simplest would be, keep incrementing a counter in while ( rs.next() ) and at the end you'll have the count. But only at the end, after the loop.
    2. Run another query with count(*) just to fetch the count.
    3. Run the same query twice, once for counting and then again for printing out. Very dumb idea though, might as well do 2. suggested above.
    4. If you have a scrollable resultset, you could go to the lastRecord and then getRow number and hence know how many there are and then rewind the resultset. I don't know how advisable using scrollable resultsets is.
    5. Create a slightly clumsy query like : select count(*) as "totalcount", emp_id, emp_name, emp_email, emp_phone from employees group by emp_id, emp_name, emp_email, emp_phone. You'll need to use the group by clause since count() is an aggregate function and you can't mix aggregate functions and columns unless you add the group by to all the columns you're fetching.

  • How to dynamically set Min count and Max Count values in Adobe Print Form?

    How to set the Min Count and Max Count values dynamically in a Print Form?
    The values when set should over ride the values set in Binding Tab.
    This is all needed to print multiple Material Number labels on a single page - and the number of labels to be printed needs to be under user control - something like an Avery Address labels
    Please advise.
    Thanks,

    Here is a work around that works for me and may not be an intelligent solution .
    I kept the Min Count to 1 on the subform binding properties.
    Per the number of labels required, I appended the same item to the internal table so many times and passed it to the label.
    it works fine for my requirement.
    However - leaving out the post for a while to see if this can be done at the form level via scripting.
    Thanks,

  • How to get record count value in variable

    Hi,
    i wanted to capture record count value in the variable?
    Please let me know how to do this?
    Thanks,
    jag

    To determine count of records, use: count(field_name) -- replace field_name with your appropriate field.
    You don't have to save the record count value in a variable. You can directly use the condition <?if: count(field_name) > 0?> display table <?end if?>
    If you want to store it in a variable: use <?variable:record_cnt;count(field_name)?>
    Take a look at this post that uses a record count: https://blogs.oracle.com/xmlpublisher/entry/no_data_found
    Thanks,
    Bipuser

  • How to count Unique Values in BEx

    Hi Guys,
    Can anybody please let me know how to count unique values of a characteristic.
    Thanx in advance
    Peter

    I have a similar scenario. If i drill up on the characterstic that had a count of one in each record, the total number of records should be stay equal to the summarised results in the last screen.
    Would someone know how to do that .
    Arti

Maybe you are looking for