Condition in count operation

Hi ALL,
I have a car table with the following attribute sale_code,model_car etc
the format of sale_code is year/number exemple when a client buy a car(model_car=mercedes) her code is 2012/0125.
I want to calculate the number of cars that were sold in the year of 2011 grouped by the model_car attribute.
select count (sale_code),model_car
from car
where sale_code like '2011%'
when I tested this querry i received an error.
My question is :
how to resolve the issue when we use an attribute in where and we use the same attribute in count operation ?
Thank you in advance.

No Error, right?
with data(salecode, model_car) as
  select '2010-01', 'BMW Z8' from dual union all
  select '2011-01', 'BMW Z8' from dual union all
  select '2011-02', 'BMW Z8' from dual union all
  select '2011-03', 'Merc' from dual union all
  select '2011-03', 'Merc' from dual
select count(salecode), model_car
  from data
where salecode like '2011%'
group by model_car;
COUNT(SALECODE)        MODEL_CAR
2                      Merc     
2                      BMW Z8   
2 rows selectedPlease follow the Sticky Thread by BluShadow on the Top of Threads list and provide the necessary information to get quick solution.
Regards,
P.

Similar Messages

  • Parallel counter operation

    Hi,
    I am trying to use two counter from the same card in paralle. I have attahed the VI here. I used the example VI to generate finite pulses to prepare my VI. Iam using PXI-6722 hardware.
    Can this operation be done? How to avoid the conflict?
    Regards
    Gopal
    Attachments:
    Parallel Counter operation.vi ‏34 KB

    Hello Gopal,
    You are receiving this error because you need both counters on the device to perform a finite pulse train generation task. You can see this Knowledgebase for more information about the problem.
    Matt Anderson
    Hardware Services Marketing Manager
    National Instruments

  • Counter operations in PXI 6722

    Hi,
    What I want to do :
    My application requires generating an analog output, after some time the DUT responds with a pulse of 1.5ms duration. I need to find the time between the point where I genrate the AO and the point where I get the pulse.
    What I am planning to do :
    I plan to start a counter at the moment I start the AO, the input pulse to counter would be a pulse train from an external clock or another counter output. I would like to stop the counter using the pulse from the DUT by connecting it to the GATE terminal. The idea is derived from the example vi, Count Digital Events-Pause Trig.vi. Based on the number of counts and the pulse train frequency, the time can be measured.
    Problems Faced and queries:
    1. I tried to test the idea by generating a continuous pulse train from counter_0 and feeding it to the source of counter_1 and use the above example to count the pulses. Here I can only pause the count using the gate input. How do I stop the counting and get the count value using the Pause trigger property?
    2. If I want to use the internal clock base instead of using another counter, how should I enable this?
    3. Is there any other option to measure the time I need?
    4. When Iam using the generate finite pulse train vi in counter_0 and connecting it to Counter_1 source. Using the count digital event, I try to count the events. Error is generated with a reason that there is a hardware conflict. Can I not use different counters in the same card for generating a finite pulse train and counting them on the other counter input?
    Regards
    Gopal

    Hi Gopal,
    Thank you for posting to the NI forums.  You can use a digital start trigger and a reference trigger to get the functionality that you need.  There is a nice Knowledge Base article on this exact issue.  The link is below.
    How Do I Use a Digital Trigger in LabVIEW to Start and Stop Acquiring Data?
    Using the information in this KB, as well as the info in the related links, you should be application to program your application in LabVIEW, but please post back if you have further questions.
    Ed W.
    Applications Engineer
    National Instruments

  • Implicit counter operation

    Hello,
         I have a question on how the implicit timing on a frequency input works.  I am inputting a straight frequency into a counter input on a cDaq unit.  I set it up using the 20Mhz Timebase. and counter 0, However If for example I input a 10Khz frequency and read data from the read counter vi every 10ms I would expect to see 10,000 * .010 samples or ~100 samples per read right?  I am only seeing about 10 samples per read though.  Am I not figuring something right?  I am setting up the sample clock as implicit using parameters (continuous, 200000 buffer size).

    You should read the section in the 917x User Manual entitled Choosing a Method for Measuring Frequency.  In summary:
    The one counter method loses accuracy as frequency increases.
    The two counter (large range) method is the same as the one counter method but it takes the measurement over N consecutive periods which allows you to increase accuracy at the expense of measurement time.  To get a reasonable accuracy at high frequencies however would require your low frequency measurements to take a very long time.
    The two counter (high frequency) method loses accuracy as frequency decreases.
    The sample clocked method has good accuracy at all frequency ranges and maintains consistent measurement time.
    The sample clocked method should be the obvious choice for measuring a large range of input signals.  However, it comes with the caveat that your input signal must be faster than the sample clock or you will receive an error and have to restart the task (which might not even be an issue depending on synchronization requirements).  You'll probably end up using a second counter to generate the sample clock.
    Best Regards,
    John Passiak

  • Setting field (system condition) required at work order operation level

    Hi everyone,
    I wanted to make 'required' system condition field at operation level, however neither it's available in OIOPL nor in OIOPD..
    I'd appreciate if anyone could suggest something
    Thanks in advance

    Hi Sergey,
    The System Condition field enables you to reserve capacity in Production Planning Work Center so that during any maintenance, Production Planning work center should not be undergoing any production.
    But the system condition that is taken into account for the above scenario is the System Condition field at the header level which indicates whether the maintenance requires the equipment to be shut down or in operation so apart from the header System Condition field, the operation system condition fields do not create any capacity requirement at PP Work Center.
    The Operation Sys Condition field is just for reporting purposes and does not hold any significance in PP-PM integration so for that fact there is no provision for setting this field mandatory at Operation level rather it can be set mandatory at Order header level.
    Best Regards,
    Muhammad Usman Kahoot

  • Count with multiple conditions (XML publisher)

    I'm trying to only count an EMPLID if multiple conditions have been met in an RTF.
    This works for 1 condition: <?count(xdoxslt:distinct_values(EMPLID[../FIRSTYEARFRESHMAN=1]))?>
    But how do I do multiple conditions? I've tried <?count(xdoxslt:distinct_values(EMPLID[../FIRSTYEARFRESHMAN=1] AND [../APPLIED_FOR_NEED_B=1]))?> and <?count(xdoxslt:distinct_values(EMPLID[../FIRSTYEARFRESHMAN=1 AND ../APPLIED_FOR_NEED_B=1]))?> but those both don't work.
    Thanks!

    similar problem for xdoxslt:distinct_values(EMPLID[condition1 and/or condition2])
    How to calculate count distinct (by xdoxslt:distinct_values) with a condition expression

  • MS dynamics crm 2011 edit xml of chart to get count of Won vs ALL opportunities

    Dear Support Team,
    We are currently working on a dashboard for our on-premise CRM dynamics 2011 instance. What we need is to display Won VS ALL opportunities of a certain account manager. I have tried exporting one of the default chart in CRM which is the Won Deals VS Lost
    Deals. I have modified the XML to get the COUNT of opportunity number for WON and LOST deals instead of  the SUM of revenue. Now, i have imported the modified xml content and was able to import it successfully. Upon checking the chart data, it shows the
    same count for WON and LOST records which is incorrect. How do i able to correct this. Please refer below to the xml codes i have imported. Looking forward to any help. Thank you.
    <visualization>
      <visualizationid>{7842C8AF-0FD2-E411-9758-F5ACB647B220}</visualizationid>
      <name>Test Chart For Comparison</name>
      <description>Shows the amount of revenue for won deals versus lost deals.</description>
      <primaryentitytypecode>opportunity</primaryentitytypecode>
      <datadescription>
        <datadefinition>
          <fetchcollection>
            <fetch mapping="logical" aggregate="true">
              <entity name="opportunity">
                <link-entity name="opportunity" from="opportunityid" to="opportunityid" link-type="outer">
                  <attribute alias="sum_lost" name="opportunityid" aggregate="count" />
                  <filter>
                    <condition attribute="statecode" operator="eq" value="0" />
                  </filter>
                </link-entity>
                <link-entity name="opportunity" from="opportunityid" to="opportunityid" link-type="outer">
                  <attribute alias="sum_won" name="opportunityid" aggregate="count" />
                  <filter>
                    <condition attribute="statecode" operator="eq" value="1" />
                  </filter>
                </link-entity>
                <attribute groupby="true" alias="groupby_column" name="nexus_accountmanager_lookup" />
              </entity>
            </fetch>
          </fetchcollection>
          <categorycollection>
            <category>
              <measurecollection>
                <measure alias="sum_won" />
              </measurecollection>
              <measurecollection>
                <measure alias="sum_lost" />
              </measurecollection>
            </category>
          </categorycollection>
        </datadefinition>
      </datadescription>
      <presentationdescription>
        <Chart Palette="None" PaletteCustomColors="97,142,206; 168,203,104; 209,98,96; 142,116,178; 93,186,215; 255,155,83; 148,172,215; 217,148,147; 189,213,151; 173,158,196; 145,201,221; 255,180,138">
          <Series>
            <Series Name="opportunity_statecode,1" Color="149, 189, 66" IsValueShownAsLabel="False" BackGradientStyle="TopBottom" BackSecondaryColor="112, 142, 50" Font="{0}, 9.5px"
    LabelForeColor="59, 59, 59">
              <SmartLabelStyle Enabled="True" />
            </Series>
            <Series Name="opportunity_statecode,2" Color="255,124,31" IsValueShownAsLabel="False" BackGradientStyle="TopBottom" BackSecondaryColor="235,98,0" Font="{0}, 9.5px" LabelForeColor="59,
    59, 59">
              <SmartLabelStyle Enabled="True" />
            </Series>
          </Series>
          <ChartAreas>
            <ChartArea BorderColor="White" BorderDashStyle="Solid">
              <AxisY LabelAutoFitMinFontSize="8" TitleForeColor="59, 59, 59" TitleFont="{0}, 10.5px" LineColor="165, 172, 181">
                <MajorGrid LineColor="239, 242, 246" />
                <MajorTickMark LineColor="165, 172, 181" />
                <LabelStyle Font="{0}, 10.5px" ForeColor="59, 59, 59" />
              </AxisY>
              <AxisX LabelAutoFitMinFontSize="8" TitleForeColor="59, 59, 59" TitleFont="{0}, 10.5px" LineColor="165, 172, 181">
                <MajorGrid Enabled="False" />
                <MajorTickMark Enabled="False" />
                <LabelStyle Font="{0}, 10.5px" ForeColor="59, 59, 59" />
              </AxisX>
            </ChartArea>
          </ChartAreas>
          <Titles>
            <Title Alignment="TopLeft" DockingOffset="-3" Font="{0}, 13px" ForeColor="0, 0, 0" />
          </Titles>
          <Legends>
            <Legend Alignment="Center" LegendStyle="Table" Docking="Bottom" Font="{0}, 11px" ForeColor="59, 59, 59" />
          </Legends>
        </Chart>
      </presentationdescription>
      <isdefault>false</isdefault>
    </visualization>
    Best regards,
    Honey Dulatre

    You'll need to create a filter for each of your two series in the xml.
    This blog post describes the process
    for filtering invididual series within the chart xml.
    Ulrik,
    Blog: http://crmchartguy.wordpress.com - Exclusively for MS CRM Charts
    Twitter: crmchartguy

  • Retrieving Query Filter conditions for a WebI Report

    I'm developing a Java program using the Business Objects SDK to gather all relevent data from a WebI report and export it to a XML document.  I'm having an issue retrieving the Filters correctly.
    Right now I have a method that retrieves a query from a query container. Then I retrieve a condition container from the query.  After that I use a loop to get the filtercondition nodes in the conditioncontainer and I get their name and ID's.  My goal is to get all the information the object, the dimension, condition, and values seperatly instead of it all printing out together. For example my code prints out this as the filter name : "Period Of Time_Air Date Greater  Enter Start Date:" .  The name contains all the information from the filter but is there a way to get each peice of information for the filter seperately. 
    I'd appreciate any help.
    Edited by: ccmagrane on Feb 28, 2011 8:55 PM
    Edited by: ccmagrane on Mar 3, 2011 2:42 PM

    Please find below a snippet code that shows how to access those objects:
    Query q=oDataProvider.getQuery();
                ConditionContainer condCont=q.getCondition();
                ConditionObject condObj=null;
                FilterConditionNode fcn = null;
                FilterCondition fc = null;
                 FilterConditionValue fcv = null;
                FilterConditionContainer fcc=q.getCondition();
                if(fcc==null)
                        continue;
                int conditionCount=q.getCondition().getChildCount();
           for(int jj=0;jj<conditionCount;jj++)
                  fcn=fcc.getFilterConditionNode(jj);
                  System.out.println(getConditionLabel(fcn));
                  if(fcn==null)
                   continue;
                if(fcn instanceof AdvancedCondition)
                        AdvancedCondition ac=(AdvancedCondition)fcn ;
                        int nDim= ac.getResultObjectCount();
                else if(fcn instanceof ConditionObject)
                   condObj = (ConditionObject) fcn;
                    fc=(FilterCondition)(condObj).getOperand();
                      if(fc!=null)
                          System.out.println("==================================================");
                             System.out.println("Operand Count - " + fc.getOperandCount());
                             for (int k =0; k < fc.getOperandCount(); k ++)
                               fcv=fc.getOperand(k);
                                   System.out.println("Operand Value - " + fcv);
                              System.out.println("==================================================");
                                 System.out.println("==================================================");
                                System.out.println("Condition Name - " + fcn.getName());
                                System.out.println("Condition Data Source Object - " + condObj.getDataSourceObject().getName());
                                System.out.println("Condition Operand - " + condObj.getOperand().toString());
                                System.out.println("Condition Operator - " + fc.getOperator());
                                System.out.println("Condition Operand Count - " + fc.getOperandCount());
                                 System.out.println("==================================================");

  • Trying to create a Javascript FetchXML query, cannot get Operator 'in' to work

    Hi all, I am writing a FetchXML query with the operator 'in' but I have messed up my syntax:
        fetchXml += "<condition attribute='statuscode' operator='in'/>";
        fetchXml += "<value>100000007</value>";
        fetchXml += "<value>100000004</value>";
    The above does not return a result. What is the correct syntax for this?

     fetchXml += "<condition attribute="statuscode" operator="in" >";
     fetchXml += "<value>100000007</value>"; 
     fetchXml += "</condition>";
     fetchXml += "<condition attribute="statuscode" operator="in" >";
     fetchXml += "<value>100000007</value>"; 
     fetchXml += "<value>100000004</value>";
     fetchXml += "</condition>";
    Regards, Saad

  • Condition type

    Hi Experts,
    In Marketing Planner - while creating a contract, agreements gets generated.
    Here the issue :  we are getting Condition types counter id rather its description.
    *In detail :*  I have created a contract with 3 entries in PCUI where its agreements gets generated once the status is approved stage.
    For a particular agreement, i am getting a condition type counter id as 042 instead of getting the description (Rebate Rate / lb).
    somehow its not getting its value whereas the other agreements get generates and able to see the description.
    this is happening only for this particular entry.
    Can anyone please provide the solution. I am using CRM 5.0.
    thanks in advance,
    Jo

    Ben,
    When using Condition Type Value of Item in Expression 1 = Zero, the value you'd enter into the Expression 1 field is the name of a page or application item, e.g., P1_EMPNO.
    When using Condition Type PL/SQL Expression, you enter a PL/SQL expression into the Expression 1 field, examples:
    true
    false
    :APP_USER = 'BENTON'
    To use the result of a boolean function, use Condition Type PL/SQL Function Returning Boolean and in the Expression 1 field put, for example:
    return func(77);
    For your specific example, an EXISTS or NOT EXISTS condition might be best. For those you put the query into the Expression 1 field.
    Scott

  • Using Container operation step can i pass one table to another?

    hi
    i have 2 multiline container elements in the workflow.
    in one of my step i am sending email using the receipents from the table LT_RECLIST which is a multiline container. Now before this step i am using a container operation step to pass LT_RECLIST_FINAL to LT_RECLIST. But guess this is not working? is this possible?
    the condition in container operation step is like this
    Result Element   LT_RECLIST
    Assignment         =     Assign (contents of table are deleted first)
    Expression          &LT_RECLIST_FINAL&
    Operator
    any idea where i am going wrong?

    instead of
    =     Assign (contents of table are deleted first)
    try the followinng option.
    <-    Add only to table (contents are extended)
    or you can directly use the element LT_RECLIST_FINAL in your mail step instead of assigning it to LT_RECLIST and using this element. if both the elements are going to store the same values then there is no point in using a separate element.

  • About condition for loop in BPM

    I design a loop, condition is counter<>3.
    It seems only receives 3 messages when I send more than 3.
    for example, I send 105 messages, for every 10 messages it will generate a file. and I totally have 11 files.
    What is the best way to end the loop?

    Hey,
           you need to have two loops in this.
           Have your send step(for the file) in the inner loop.
            The condition for this loop will be te number of messages that you need per file.
          The outer loop should terminate when all the messages are recieved.(recieve step will be in the outer loop)
       This is not possible with the no. of messages
    You can do one thing, provide a stop message as an input along with the other messages.
    And set the condition for the outer loop for the stop message.
    This will terminate the outer loop.
    regards,
            Milan

  • Operator="in" , Fetch Xml, MS CRM 2011

    hi,
    i have a guid's string array.
    ex: string[] recordGuids;
    i want to use this in fetchxml by using condition operator "in".
    i have tried this below code but no success ("The remote server returned an error: NotFound.").
    var fetchXml = @"<fetch mapping='logical'>
    <entity name='annotation'>
    <attribute name='filename' />
    <filter>
    <condition attribute='objectid' operator='in'>"+
    "<value>" + recordGuids + "</value>" +
    "</condition>"+
    "</filter>"+
    "</entity>"+
    "</fetch>";
    when i debug and check the query, that was something like this( which is wrong query ).
    <fetch mapping='logical'>
    <entity name='annotation'>
    <attribute name='filename' />
    <filter>
    <condition attribute='objectid' operator='in'> <value>System.String[]</value> </condition> </filter> </entity></fetch>
    can anyone give me an idea to retrieve set of records by using condition operator "in" by passing string array.
    Thanks and Regards. Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.

    hi Can you please try below code,
    var fetchXml = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='true'>" +
    "<entity name='new_pledge'>" +
    "<attribute name='new_name' />" +
    "<attribute name='new_pledgeid' />" +
    "<attribute name='new_marketvalue' />" +
    "<order attribute='new_name' descending='false' />" +
    "<filter type='or'>" +
    "<condition attribute='new_pledgeid' operator='eq' value='";
    for(var i = 1; i<= Pledgeid.length;i++)
    fetchXml += "<value>" + Pledgeid[i] + "</value>";
    fetchXml += "' />"+
    "</filter>" +
    "</entity>" +
    "</fetch>";
    var layoutXml = "<grid name='resultset' object='1' jump='name' select='1' icon='1' preview='1'>" +
    "<row name='result' id='new_pledgeid'>" +
    "<cell name='new_name' width='300' />" +
    "<cell name='new_pledgeid' width='100' />" +
    "<cell name='new_marketvalue' width='100' />" +
    // "<cell name='new_by_months' width='100' />" +
    "</row>" +
    "</grid>";
    By Sanz. -- If you find this post helpful then please "Vote as Helpful" and "Mark As Answer".

  • Is "starting" a counter the same as "arming" it?

    Hi everyone,
    I am trying to understand why I get unexpected behavior with my VI and counter output.
    I am outputting 3 single,triggered pulses: 2 on a 6602 (1 each on counters 0 and 1), and 1 on GPCTR0 on a 6071E.
    The second pulse on the 6602 (on counter 1) is supposed to immediately pulse after the first pulse (on counter 0) is finished pulsing.
    GPCTR0 is a pulse used to start my data acquisition, and occurs before the first pulse from the 6602.
    All three counters share a common hardware trigger, a repeating 120Hz pulse, synced to some of my other hardware. This train of triggers arrive only after I switch a DIO line (on yet another card, a 6503), and this DIO line is turned on the a sequence frame after the frame in which I set up and "start" my counters (with control.vi set to "start").
    Now here's the problem I encounter:
    *most* of the time (~4/5 times) I get the output I want from the 6602, 1 pulse right after the other. But every once in a while, I get the pulses ~8 ms apart--that is, counters 0 and 1 are triggering off different trigger pulses in the 120Hz I send to the gates. So one of my counters is somehow missing seeing the start trigger that another counter sees.
    How can this be? If all counters are already started, shouldn't the same start-trigger trigger all of the counting operations at once?!
    Also problematic, every once in a while, counter 0 is missing the first hardware trigger, but triggers on the second trigger of the 120 Hz trigger pulses. So it seems my problem is that the counters are sometimes just missing seeing the triggers.
    Any ideas? I posted my VI. The relevant portions are in big frame3, inner frames 3 and 5. (frame 3 configures and starts all counters. frame 5 turns on my hardware triggers).
    thanks in advance for any help!
    Attachments:
    Neurochip-legacy.vi ‏698 KB

    to answer my own question....
    i discovered something miswired in my hardware.
    so there seems to be no labview problem...

  • Mappings between table operator and joiner operator

    HI all,
    I am new to owb. I am trying to create a mapping in the OWB Mapping Editor where the scenario looks like :
    table1 operator ---------> joiner file operator
    i am looking at earlier mappings' sql code and found that there is a where clause condition that governing the above such scenario such as:
    where table1.column value = "something" then load into joiner file operator.
    But in the mapping editor, i cannot find any way to add this condition by clicking on the column name of table1. Please help.
    thank you.

    Hi
    A joiner will make one output from 2 or more inputs. A joiner has a join condition which if you select the operator (not a group or an attribute with operator) the property inspector will have a join condition for detailing the 'where' clause.
    If you want to filter a single input then use a filter operator. Again like condition the filter operator has a filter condition which if you select the operator (not a group or an attribute with operator) the property inspector will have a filter condition for detailing the 'where' clause.
    Cheers
    David

Maybe you are looking for