"Count" Statement IN Formula

Post Author: LHooker
CA Forum: General
I would like to create a report that creates totals for each individual salesman (Group #1). The criteria is determine by a "LIKE" statement (i.e. LIKE "Port"). I need the total amount and the number of records for each salesman. I tried to do this in a fomula, but can't seem to get the right total for the number of records.  It's counting every record. How can I count the number records that meets the specified criteria ? Below is an example of the formula for counting the number of records:
If ({itemtype.Description} like "Port") ThenCount({itemtype.Description})

Post Author: SKodidine
CA Forum: General
You could try it with a running total.  Count on {itemtype.Description} and for evaluate, use a formula and type {itemtype.Description} like "Port" and Never Reset.  See if that will work for you.

Similar Messages

  • What is the Count function in formula of Query Design?

    What is the Count function in formula of Query Design?  Could someone gives an example?
    Thanks!

    Example :
    COUNT of
    Also, check :
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/7e58e690-0201-0010-fd85-a2f29a41c7af

  • IF statement in Formula Node

    I have the following statement in a Formula Node in LabVEW 7.1:
    if (x=1) y = 3; else y = 1;
    When running the VI, whatever the value of X is, I obtain Y = 3 !!!!
    Why ???
    Tom

    Try x == 1 (instead of x = 1).
    Using LV8.0
    Don't be afraid to rate a good answer...

  • If-then statement in formula node

    **Note - The attached file shows the current block diagram.
    I have a formula node inside a for loop. Inside the formula node I am trying to program the if-then statement:
    If T1<2.0E-5 OR T1>5.5E-4 THEN GOTO 3
    U7=U7+V
    I have 4 items I need help with:
    (1) Is 'II' the correct operator for 'OR'?
    (2) Is 'goto' an acceptable operator within LabVIEW?
    (3) 'U7' is building a 1D array. How do I need to define it? Is it simply 'int U7'? Also, I will add an output value named 'U7' on the formula node wall with an indicator wired to it from outside the for loop.
    (4) Is my use of the equal sign appropriate or do I need to use '=='?
    Thanks for the help.
    Philip
    Attachments:
    if-then_in_FN.jpg ‏18 KB

    Thanks for the help. I went ahead and rewrote the program so I could omit the 'goto's. Another problem that I am having is that I want 2 statements for 1 assignment:
    if (T1>=.002004 && T1<=.002584)
    B1=U
    A1=V;
    I want to assign both B1 and A1 values when the above condition is true. I tried a comma between the U and A1 but it doesn't work as well. Should I define A1 and B1 separately? Or would this create problems?
    if (T1>=.002004 && T1<=.002584)
    B1=U;
    if (T1>=.002004 && T1<=.002584)
    A1=V;
    Thanks,
    Philip

  • Syntax and format of a IF statement in formula XPath in a InfoPath field

    Good day
    I needed assistance with IF statement syntax in a InfoPath field formula.
    If Field_1 = null
    concat(substring-before(txtComponentNo1, "."), ".", substring-before(field17, "."), ".", substring-after(field17, "."))
    Else
    concat(substring-before(txtComponentNo1, "."), ".", substring-before(field17, "."), ".", substring-after(field17, ".")+1)
    or in Advance XPath
    If Field_1 = null
    concat(substring-before(../../../my:grpComponent_1/my:grpComponent1/my:txtComponentNo1, "."), ".", substring-before(../../my:field17, "."), ".", substring-after(../../my:field17, "."))
    Else
    concat(substring-before(../../../my:grpComponent_1/my:grpComponent1/my:txtComponentNo1, "."), ".", substring-before(../../my:field17, "."), ".", substring-after(../../my:field17, ".") + 1)
    Thanks

    Hi,
    Here is the good explanation of what you are looking for.
    http://blogs.msdn.com/b/infopath/archive/2006/11/27/conditional-default-values.aspx
    and please check this as well for basic understanding
    http://www.bizsupportonline.net/infopath2010/if-else-statements-conditions-rules-infopath-2010.htm
    Krishana Kumar http://www.mosstechnet-kk.com

  • Select count(*) statement in ABAP

    Hi,
    Im writing following statement in my Function module,
    select count(*) into l_count
    from user_master
    where username = l_username and
          process_type = processtype and
          password = oldpassword.
    And there is one entry in table user_master.
    But still, I'm getting l_count as zero..
    Can somebody help me with this.
    Regards,
    Amey

    select count(*) into l_count
    from user_master
    where username = l_username and
    process_type = processtype and
    password = oldpassword.
    Use group by option...
    Like this....
    select count(*) into l_count
    from user_master
    where username = l_username and
    process_type = processtype and
    password = oldpassword group by username.

  • Giving OR Statement in formula evaluates only one condition

    This is the formula I used in the reports record selection. I need to display the records in division number = 9 and division number = 20 and need records where other field top account = true as well in the reports. But it displays only first condition and not the second condition. The reason might be it checks for true for the first field and it ignores the second condition.
    ({Opportunity.Division Number} in ["09", "20"]) or {Opportunity.Top Account} = true
    I can't use and statement here, because I need records for all the conditions.  However it works in select query in oracle but not in crystal report.
    Let me know if there is any alternative.

    As Raghavendra.G suggests, if {Opportunity.Division Number} is null, the formula will not work as expected.  Crystal halts execution of any formula whenever it encounters a null value - unless it is enclosed in the IsNull() function.  It does sound like that is what your problem is, as the condition is correct for what you are trying to do.
    Perhaps you need to change the condition to:
    ({Opportunity.Top Account} = true) or {Opportunity.Division Number} in [09,20])
    (assuming the issue is a null Division Number...)
    HTH,
    Carl

  • Getting Long time to execute select count(*) statement.

    Hi all,
    My table have 40 columns and it doesn't have the primary key column. it contain more than 5M records. it's taking long time to execute simple sql statement.
    Such as select (*) take 1min and 30 sec. If i use select count(index_colunm) then it finished with in 3s. i did the following workarounds.
    Analyzed the table.
    created required indexes.
    yet getting the same performance issues. please help me to solve this issue
    Thanks

    BlueDiamond wrote:
    COUNT(*) counts the number of rows produced by the query, whereas COUNT(1) counts the number of 1 values.Would you care to show details that prove that?
    In fact, if you use count(1) then the optimizer actually re-writes that internally as count(*).
    Count(*) and Count(1) are have identical executions.
    Re: Count(*)/Count(1)
    http://asktom.oracle.com/pls/asktom/f?p=100:11:6346014113972638::::P11_QUESTION_ID:1156159920245

  • Iweb hit counter stats

    I know I can get a 3rd party hit counter, but I am curious if I can see how many hits my site has received without visiting the site itself? In the old, old .mac Homepage you could see how many hits yoru site received when you logged into your .mac account on Apple's website. Is there a place to do this with iweb? I don't need any fancy stats. Just curious about hits.
    Dan

    http://www.apple.com/feedback/iweb.html
    http://www.apple.com/feedback/mobileme.html

  • Resetting devices and counter states

    How frequently should one make use of Reset Device? I have placed it at the start of a LabView program so that it runs every time this program is called. This is because we sometimes use Traditional DAQ applications and sometimes DAQmx. Is this necessary?
        Also, I would like the counter to initialize at 0V. Now it puts out 5 V after Reset Device. I am using the NI6715 PCMCIA card. Right now, I reset the device and then ask for 2 ticks high (the minimum) and 1000 ticks low with the Idle State on Low. Then I call for Start Task and Wait Until Done to force the counter low. There are times when the counter needs to be forced high. With DAQmx, what is a good way to toggle the counter as needed? The counter is controlling a switch that sometimes needs to pulse and sometimes needs to remain in one position or the other.
        Thanks,
    Peg

    Hello Peg,
    Reset device is only necessary if the device is left in a state that
    the driver will not be able to communicate.  This can happen if a
    previous task is not stopped/cleared and a new task is created or
    sometimes when going from one driver to another (Traditional DAQ to
    DAQmx or vice versa). 
    If you are not getting an error when you start your code, the reset is
    not necessary. If you happen to get an error, you can manually reset
    your device in MAX, or you can even conditionally reset the card in
    your code (i.e. try to create and start your task and if an error
    occurs, call the reset device function and rerun the code.
    You do not need to completely run a task to set the idle state.  You
    can use a DAQmx Control Task function with the action set as "commit"
    to make the idle state take effect.  First you would configure the task
    you eventually want to run on the counter, then commit it.  Later when
    you want the counter output pulse to run you can call the DAQmx Start
    Task function. When you need to change the idle state, simply clear the
    task and begin a new one in the same manner with the appropriate idle
    setting.  A digital line is an alternate option which can be simply
    written high or low.
    Hope this helps,
    Jennifer O.
    Applications Engineer
    National Instruments

  • Categorize and count each using Formula Workshop

    Hi, I am trying to categorize all records like this
    Formula name is called SLA
    IF {F_TASKS.TA_STATUS}in["ACTIVE","ASSIGNED"]
    AND {SLA_Task_Performance.TaskPerfSLAFixDate}  > CurrentDateTime
    THEN 'SAFE OPEN'
    ELSE
    IF {F_TASKS.TA_STATUS}in["ACTIVE","ASSIGNED"]
    AND {SLA_Task_Performance.TaskPerfSLAFixDate}  <=  CurrentDateTime
    THEN 'FAILED OPEN'
    ELSE
    IF {F_TASKS.TA_STATUS}IN["COMPLETE","HISTORY","CANCELLED"]
    AND ({SLA_Task_Performance.TaskPerfFixDate} <=
    {SLA_Task_Performance.TaskPerfSLAFixDate})
    OR ISNULL({SLA_Task_Performance.TaskPerfFixDate})
    THEN 'SAFE CLOSED'
    ELSE
    'FAILED CLOSED'
    After putting SLA to crosstab header, counts for each categories are shown depending on what category it is. However, I only want to show SAFE CLOSED.
    I did try to use specified SAFE CLOSED from the grouping option and disregard others, to get its percentage. However it doesn't get the exact percentage of only SAFE CLOSED. as it only gets the 100%.
    Can anyone help me to get the exact percentage of only SAFE CLOSED?
    Many Thanks

    Hi Abilash,
    Please check the screenshot below.
    this shows when I remove the FAILED CLOSED,SAFE OPEN and FAILED OPEN in the grouping.

  • Re Count statement n times using the same column

    Hi All,
    I am struggling with a query. I am using a column to count using a wildcard for 'N1%', I want to be able to also count for 'N2%' up to 'N5%' in the query.
    My query is as follows:
    SELECT s.name as name, count (cs.pri_comment_txt) as N1
    FROM systems s, clientstate cs
    WHERE cs.supportpriority is NOT NULL
    AND cs.assignedname is null
    AND s.systemid = cs.systemtype
    AND cs.pri_comment_txt like 'N1%'
    group by rollup (s.name)
    Thanks inadvance
    Regards

    I think you mean something like this (untested)?
    SELECT s.name as name
    , count (case when cs.pri_comment_txt like 'N1%' then 1 else null end) as N1
    , count (case when cs.pri_comment_txt like 'N2%' then 1 else null end) as N2
    , count (case when cs.pri_comment_txt like 'N3%' then 1 else null end) as N3
    , count (case when cs.pri_comment_txt like 'N4%' then 1 else null end) as N4
    , count (case when cs.pri_comment_txt like 'N5%' then 1 else null end) as N5
    from systems s
    , clientstate cs
    where cs.supportpriority is not null
    and cs.assignedname is null
    and s.systemid = cs.systemtype
    and (
       cs.pri_comment_txt like 'N1%'
       or cs.pri_comment_txt like 'N2%'
       or cs.pri_comment_txt like 'N3%'
       or cs.pri_comment_txt like 'N4%'
       or cs.pri_comment_txt like 'N5%'
    group by rollup (s.name);cheers,
    Anthony

  • What's wrong with my SELECT/COUNT(*) statement?

    I am trying to get a total count of records related to a single master record within one table, and if I test this in the DW recordset wizard, I get the results I need. By testing it, I mean if I enter something other than the default -1, where there are results related to another 'master record', then I end up with the correct amount of rows, but when I test it in a browser, all I am getting is '0' for all records.
    This bit of code is setting the 'master record ID' to which others will relate to:
    <?php $_GET['trcount'] = $row_rs_replycount['fld_fID'] ?>
    This is my recordset which is inline with the code which is inside a repeat region:
    <?php
    $threadreplys_rs_replycount = "3";
    if (isset($_GET['trcount'])) {
      $threadreplys_rs_replycount = $_GET['trcount'];
    mysql_select_db($database_conn_mrs, $conn_mrs);
    $query_rs_replycount = sprintf("SELECT *, COUNT(*) AS countTOT FROM tbl_forumPOSTS WHERE fld_fTHREADID = %s ORDER BY fld_fID DESC", GetSQLValueString($threadreplys_rs_replycount, "int"));
    $rs_replycount = mysql_query($query_rs_replycount, $conn_mrs) or die(mysql_error());
    $row_rs_replycount = mysql_fetch_assoc($rs_replycount);
    $totalRows_rs_replycount = mysql_num_rows($rs_replycount);
    ?>                       
    And this is the code to display the total number of records that are related
    <?php echo $row_rs_replycount['countTOT']; ?>
    As I say, I have it working when testing different default values in the recordset wizard, but not live on a page.
    Thanks.

    >"SELECT *, COUNT(*) AS countTOT FROM tbl_forumPOSTS WHERE....
    That SQL is not valid - at least not by SQL standards. If your query contains an aggregate, then all columns that are not aggregated must be in a group by clause. It's possible that MySQL implicitly adds all non-aggreated columns to a group by, but you should probably fix it anyway. If you don't need to use the other columns from that table in the recordset, then just remove the * from the select list.
    "SELECT COUNT(*) AS countTOT FROM tbl_forumPOSTS WHERE....
    If you still have a problem, then output the value in $totalRows_rs_replycount to see if you are getting any rows returned from your query.
    Next, comment out these lines:
    if (isset($_GET['trcount'])) {
      $threadreplys_rs_replycount = $_GET['trcount'];
    to make sure any value in trcount is not interfering with the default value of '3' and see if that returns any results.

  • Several count() statements from same table?

    Hello all,
    I have to count number of bills (several million entries) connected to contracts (aprox. 75000 entries). When I try
    select contract.number,count(bill.id),count(a.id)
    from contract,bill, bill a
    where bill.contractid = contract.id
    and bill.type = 0
    and a.contractid = contract.id
    and a.type = 1
    the result of count(a.id) is always the same as count(bill.id). Well knowing that this is wrong, I've tried to change the count() into own select-statments but that doesn't help and the performance is more than poor.
    Does anybody have an idea to get the correct count-results with a suitable performance?
    Thanks Carsten

    Hi, Carsten,
    Instead of joing separate copies of the bill table for each type (for which you might need outer joins), just join one copy, on the broadest possible conditions.
    You can use CASE expressions to count which rows joined on different criteria, like this:
    SELECT    contract.contract_number
    ,       COUNT (CASE WHEN bill.type = 0 THEN bill.id END)     AS type_0_cnt
    ,       COUNT (CASE WHEN bill.type = 1 THEN bill.id END)     AS type_1_cnt
    FROM       contract
    ,       bill
    WHERE       contract.id     = bill.contractid
    AND       bill.type     IN (0, 1)
    GROUP BY  contract.contract_number
    ;Output:
    CONTRACT_NUMBER           TYPE_0_CNT TYPE_1_CNT
    contract 1                         4          2Do you really want 1 in the last column? If so, explain how you get that value.
    NUMBER is a reserver word in Oracle, so it's not a good column name.
    Edited by: Frank Kulash on Nov 30, 2009 9:38 AM
    Edited by: Frank Kulash on Nov 30, 2009 9:52 AM
    Changed "THEN 1" to 'THEN bill.id", after Bhushan

  • All sql is working fine except for the COUNT statement ... ?

    This piece of code using taglib
    <%@ taglib prefix="sql" uri="http://java.sun.com/jstl/sql" %>
    <sql:query var="aantalantw" scope="session">
              SELECT COUNT(*) FROM antwoorden
    </sql:query>
    <c:out value="${aantalantw}"/>
    This result should be something like 12 or some other number of course
    but i seem to get this :
    org.apache.taglibs.standard.tag.common.sql.ResultImpl@fbcb70
    Ideas ?

    Sorry, I made a mistake. The right code is:
    <sql:query var="aantalantw" scope="session">
    SELECT COUNT(*) AS count FROM antwoorden
    </sql:query>
    <c:forEach var="aantalantw_row" items="aantalantw.rows">
    <c:out value="${aantalantw_row.count}"/>
    </c:forEach>

Maybe you are looking for

  • Error message when restoring my 4th generation iPod touch

    I own a 4th generation iPod touch. Eventually the device it self became slow. So there fore I tried to restore it. But unfortunately, the process failed. I tried this method several times and It gives an error message every time when start the proces

  • Unable to Delete Folder, Could not find this item

    Currently, I'm having problem deleting an old Folder. Previously, I used its parent as a shared folder, but one day when I tried to clear that folder there is one folder that has duplicate. The problem is one of them (the old one) can't be deleted ev

  • Sites ending with .gov.sg appear to be blocked. How do I gain access?

    I have not been able to access these sites for 2 days. The sites are actually up, I can still access them from my AT&T smartphone. So Verizon appears to be blocking them. I regularly need to access these sites, so I would probably need to change prov

  • Why is my apple ID keep saying I need to verify it?

    Every time I try to log in on my iTunes, it says I need to verify my Apple ID which I did my first time and now it keeps saying that.

  • Xorg not registering synaptics touchpad

    Hi, I'm having an odd problem here. Every so often when I boot my netbook (Acer aspire one 110) my touchpad loses all it's settings. The xorg log shows this [ 14.387] (II) config/udev: Adding input device PS/2 Synaptics TouchPad (/dev/input/event10)