Disable Grouping on Data Condition

Post Author: Sriram Venkataramani
CA Forum: General
Hi,
I have a group in my report which want to disable altogether (NOTE: I don't want to just suppress it - I want to remove the grouping itself from the report) on a conditional variable in my data. How do I do this?
Thanks!
- Sri

Post Author: Sriram Venkataramani
CA Forum: General
No need to be so hostile. I think the question is pretty straight forward. If you want more details all you have to do is ask. Use a real punching bag ifyou're angry with something else.As you asked for more details here you go ... Version: Crystal Report XIDatabase: Oracle 10gExample Data & Expected Output: I can't give you the details but the report input consists of a DataSet with two tables: one with all the data in which one column is called counterparty. The other table is called prompts which has just one row (containing all the input prompts like date, account selected etc.) in which one of the columns is called GroupByCounterparty. If the value in the GroupByCounterparty is set to true, the grouping should occur by the value in the counterparty column, else it should not. I posted in one of the other Google groups forums and the reply that I got was to create two reports one with the grouping and one without. I think there is a better way of doing this without creating two reports (as that would require maintaining two crystal reports etc.). Thanks! - Sri

Similar Messages

  • Date condition not working correctly in Desktop

    Hello,
    I have two custom folders in Admin that are joined. One of the folders contains the following query:
    SELECT ORGANIZATION_ID, ASSET_NUMBER, MIN(CURRENT_READING_DATE) FIRST_READ_DATE, MIN(CURRENT_READING) FIRST_READING
    FROM EAM_METER_READINGS_V
    WHERE PREV_DESC IS NULL
    Group By ORGANIZATION_ID, ASSET_NUMBER
    I want my workbook to report the earliest meter reading that exists, based on the date that is specified in the parameters in Desktop. When I create a parameter for the date, the workbook reports the earliest reading in the database; it ignores the date restriction entered in the parameter. This is the parameter:
    First Read Date MIN BETWEEN :First Reading Date and SYSDATE
    If I include the date condition in the SQL of the custom folder the workbook functions exactly as it should. The date condition is in the SQL as the following:
    and current_reading_date between '01-JAN-2007' and SYSDATE
    Since the workbook functions correctly when the condition is coded in the SQL but not when it is based on a parameter, I assume the problem is with the parameter. Any ideas on how I may correct this?
    Thanks,
    Steve

    Thanks for the response Michael. I tried using the MIN function as you suggested, but I still am not getting the expected result. I’m not sure that I was clear in my initial problem description. I will try to provide more detail with this post.
    The reason I have two custom folders is that my original query has a nested Select statement (EAMV) and I couldn’t find a way to pass the parameter from EAMV to Discoverer. Following is the original query. I suppose the first logical questions would be, is there a way to pass the parameter to Discoverer? Would this alleviate the need for the second custom folder?
    SELECT K.ORGANIZATION_CODE "ORG" -- ORGANIZATION
    , K.ORGANIZATION_ID
    ,A.NAME "PM SCHEDULE NAME" -- PREVENTIVE MAINTENANCE SCHEDULE NAME
    --( (B.RUNTIME_INTERVAL/F.USER_DEFINED_RATE) + D.LAST_SERVICE_END_DATE) "PROJECTED READ DATE" -- USES USER_DEFINED_RATE FROM METER DEFINITION
    ,(C.LAST_SERVICE_READING + B.RUNTIME_INTERVAL) "PROJECTED READ UNITS" -- NEXT SERVICE READING DUE UNITS
    ,F.METER_UOM "UOM" -- UNIT OF MEASURE ON METER
    ,F.METER_NAME "METER NAME" -- METER NAME
    ,G.SERIAL_NUMBER "MAINT EQ NO" -- MAINTAINED EQUIPMENT NUMBER
    ,H.C_ATTRIBUTE1 "MAKE" -- MAINTAINED EQUIPMENT NUMBER - MAKE/MANUFACTURER
    ,H.C_ATTRIBUTE2 "MODEL" -- MAINTAINED EQUIPMENT NUMBER - MODEL
    ,H.C_ATTRIBUTE4 "SERIAL NO" -- MAINTAINED EQUIPMENT NUMBER - SERIAL NUMBER
    ,I.SEGMENT1 "ACTIVITY" -- ASSET ACTIVITY
    ,D.LAST_SERVICE_END_DATE "LAST READ DATE" -- DATE OF LAST PM SERVICE READING
    ,C.LAST_SERVICE_READING "LAST READ UNITS" -- UNITS OF LAST PM SERVICE READING
    ,E1.CURRENT_READING_DATE "CURRENT READ DATE" -- DATE OF CURRENT SERVICE READING (FROM METER FORM)
    ,E1.CURRENT_READING                                   "CURRENT READ UNITS" -- UNITS OF CURRENT SERVICE READING (FROM METER FORM)
    ,E1.LIFE_TO_DATE_READING "LIFE TO DATE READING" LIFE TO DATE READING
    --,(E1.CURRENT_READING - C.LAST_SERVICE_READING) "CURRENT/LAST VARIANCE" -- UNITS SINCE LAST PM SERVICE READING
    ,( (C.LAST_SERVICE_READING + B.RUNTIME_INTERVAL) - E1.CURRENT_READING ) "PROJECTED/CURR VARIANCE" -- UNITS REMAINING UNTIL NEXT SCHEDULED READING
    ,J.DESCRIPTION "LOCATION" -- OWNING DEPARTMENT DESCRIPTION OF ASSET NUMBER
    ,J.DEPARTMENT_CODE
    ,E1.DISABLE_FLAG
    ,G.CURRENT_STATUS
    ,B.RUNTIME_INTERVAL
    ,Y.SET_NAME
    ,EAMV.FIRST_READ_DATE READ_DATE
    ,EAMV.FIRST_READING READING
    FROM EAM.EAM_PM_SCHEDULINGS A
    ,EAM.EAM_PM_SCHEDULING_RULES B
    ,EAM.EAM_PM_LAST_SERVICE C
    ,INV.MTL_EAM_ASSET_ACTIVITIES D
    ,EAM.EAM_ASSET_METERS E
    ,EAM.EAM_METER_READINGS E1
    ,EAM.EAM_METERS F
    ,INV.MTL_SERIAL_NUMBERS G
    ,INV.MTL_EAM_ASSET_ATTR_VALUES H
    ,INV.MTL_SYSTEM_ITEMS_B I
    ,BOM.BOM_DEPARTMENTS J
    ,INV.MTL_PARAMETERS K
    ,EAM.EAM_PM_SET_NAMES Y
         ,(SELECT ORGANIZATION_ID, ASSET_NUMBER, MIN(CURRENT_READING_DATE) FIRST_READ_DATE, MIN(LIFE_TO_DATE_READING) FIRST_READING
              FROM EAM_METER_READINGS_V
              WHERE CURRENT_READING_DATE BETWEEN '01-JAN-2007' AND '30-JUN-2007'
              GROUP BY ORGANIZATION_ID, ASSET_NUMBER) EAMV
    WHERE A.PM_SCHEDULE_ID = B.PM_SCHEDULE_ID
    AND A.ACTIVITY_ASSOCIATION_ID = C.ACTIVITY_ASSOCIATION_ID
    AND C.ACTIVITY_ASSOCIATION_ID = D.ACTIVITY_ASSOCIATION_ID
    AND D.SERIAL_NUMBER = E.ASSET_NUMBER
    AND D.ORGANIZATION_ID = E.ORGANIZATION_ID
    AND E.METER_ID = E1.METER_ID
    AND E1.METER_READING_ID =
    (SELECT MAX(METER_READING_ID)
    FROM EAM_METER_READINGS
    WHERE METER_ID = E1.METER_ID
    AND (DISABLE_FLAG = 'N' OR DISABLE_FLAG IS NULL))
    AND E.METER_ID = C.METER_ID
    AND E.METER_ID = B.METER_ID
    AND E.METER_ID = F.METER_ID
    AND D.MAINTENANCE_OBJECT_ID = G.GEN_OBJECT_ID
    AND D.ORGANIZATION_ID = G.CURRENT_ORGANIZATION_ID
    AND G.SERIAL_NUMBER = H.SERIAL_NUMBER
    AND G.CURRENT_ORGANIZATION_ID = H.ORGANIZATION_ID
    AND D.INVENTORY_ITEM_ID = H.INVENTORY_ITEM_ID
    AND H.ATTRIBUTE_CATEGORY = 'EQUIPMENT DETAILS'
    AND D.ASSET_ACTIVITY_ID = I.INVENTORY_ITEM_ID
    AND D.ORGANIZATION_ID = I.ORGANIZATION_ID
    AND G.OWNING_DEPARTMENT_ID = J.DEPARTMENT_ID (+)
    AND I.ORGANIZATION_ID = K.ORGANIZATION_ID
    AND A.SET_NAME_ID = Y.SET_NAME_ID
    AND Y.SET_NAME IN ('MAIN','COMP')
    AND G.CURRENT_ORGANIZATION_ID = EAMV.ORGANIZATION_ID
    AND G.SERIAL_NUMBER = EAMV.ASSET_NUMBER
    AND K.ORGANIZATION_CODE = 'MCC'
    Using this query I want to show the most recent reading (current reading) and then give users the flexibility to enter an earlier date so the earliest reading as of that date will also show. For example, if they enter 1-JAN-2007 as the parameter and there was a reading taken on 2-JAN-07 and 28-JAN-07, the report should show the 2-JAN-2007 reading (in addition to the most recent reading in a separate column). Currently, everything on the report displays correctly, except for the reading based on the parameter.

  • How to hide fields in Web UI on basis of some data conditions

    Hi,
    Is there any way we can hide the fields on some data conditions, i know we can disable the field in get_i method but just wondering if we can hide it completely.
    Regards,
    Kamesh

    As far as I know there is no way to hide a field via the provided methods (Ex: GET_xxx...). The only way I reckon you can achieve this is to create a separate UI config for the fields you want to hide. I assume your scenario is simple else it would not make sense to create a ton of UI configs or would it?

  • Requires a user to input a date (condition [%0])

    Hi, 
    I'm trying to write a query that requires a user to input a date (condition [%0]).  The data brought back would show invoices with activity but I need to get only the invoices that are 60 days past due from the date the user inputs.
    --SELECT T0.[DocNum]'Invoice No.',
    --T0.[CardCode],
    --T0.[CardName],
    --T1.PYMNTGROUP,
    --T0.[DocDate],
    --T0.[DocDueDate],
    --DATEDIFF(DAY,T0.DOCDUEDATE,GETDATE())'Past Due',
    --T0.[DocTotal] 'Balance Due',
    --MAX(T2.RECONTACT)'Last Activity',
    --max(t2.details)'Activity Details'
    --FROM OINV T0 LEFT JOIN OCTG T1 ON T0.GROUPNUM=T1.GROUPNUM LEFT JOIN OCLG T2 ON T0.CARDCODE=T2.CARDCODE
    --WHERE T0.[Docstatus] ='o' and
    --T0.docduedate<getdate() -60
    --GROUP BY T0.[DocNum], T0.[CardCode], T0.[CardName],T1.PYMNTGROUP, T0.[DocDate], T0.[DocDueDate] ,
    --DATEDIFF(DAY,T0.DOCDUEDATE,GETDATE()),T0.[DocTotal]

    Hi,
    Welcome you post on the forum.
    Try this:
    Declare @ToDate DateTime
    SET @ToDate = /(SELECT T0.DocDate FROM OINV T0 where T0.DocDate =/ '[%0\]'
    SELECT T0.DocNum'Invoice No.',
    T0.CardCode,
    T0.CardName,
    T1.PYMNTGROUP,
    T0.DocDate,
    T0.DocDueDate,
    DATEDIFF(DAY,T0.DOCDUEDATE,@ToDate)'Past Due',
    T0.DocTotal 'Balance Due',
    MAX(T2.RECONTACT)'Last Activity',
    max(t2.details)'Activity Details'
    FROM OINV T0 LEFT JOIN OCTG T1 ON T0.GROUPNUM=T1.GROUPNUM LEFT JOIN OCLG T2 ON T0.CARDCODE=T2.CARDCODE
    WHERE T0.Docstatus ='o'
    GROUP BY T0.DocNum, T0.CardCode, T0.CardName,T1.PYMNTGROUP, T0.DocDate, T0.DocDueDate ,
    DATEDIFF(DAY,T0.DOCDUEDATE,@ToDate),T0.DocTotal
    Having DATEDIFF(DAY,T0.DOCDUEDATE,@ToDate)>60

  • How to Avoid Grouping for some conditions?

    Hi,
    I am facing a problem in Sales_commission Report. In this report I am grouping data Based upon first by
    salesman and then by customer. And also some sorting conditions. I designed all grouping by using report wizard.
    The problem is: If sort_by Parameter =customer then only need to group data based customer.
    Else ie if sort_by= 'order_no' or 'Inv_no' then no need of grouping the data by customer. Display data
    as per sorting condition.
    Is there any solution for this problem?

    Hi,
    I am facing a problem in Sales_commission Report. In this report I am grouping data Based upon first by
    salesman and then by customer. And also some sorting conditions. I designed all grouping by using report wizard.
    The problem is: If sort_by Parameter =customer then only need to group data based customer.
    Else ie if sort_by= 'order_no' or 'Inv_no' then no need of grouping the data by customer. Display data
    as per sorting condition.
    Is there any solution for this problem?There is no way to remove the grouping based on customer, so sorting based on customer will be retained.
    Way to hide the customer group fields in the customer repeating frame is by using format triggers based on sort_by_parameter,
    and place the customer fields in the last group repeating frame also and show or hide this fields depending on sort_by_parameter.
    Hope this helps.
    Best Regards
    Arif Khadas

  • How to avoid grouping by date with dates as incoming parameters?

    Hello, I have the following Query from SAP Business One set as DataSource:
    SELECT  T1.SlpName as 'Vendor', convert(varchar(12), T0.[U_ER_PROV])as 'City', T0.[CardCode] as 'Client Code', T3.CardName as 'Client Name', T0.DocDate as 'Date', T2.ItemCode, T4.ItemName as 'Reference Description', sum (T2.Quantity) as 'Toal Units per Reference',
    avg (T2.Price)as 'Average Price', sum(T2.LineTotal) as 'Total'
    FROM ODLN T0
    INNER JOIN OSLP T1
    ON T0.SlpCode = T1.SlpCode
    INNER JOIN DLN1 T2
    ON T0.DocEntry = T2.DocEntry
    INNER JOIN OCRD T3
    ON T0.CardCode = T3.CardCode
    INNER JOIN OITM T4
    ON T2.ItemCode = T4.ItemCode
    group by  T1.SlpName, convert(varchar(12), T0.[U_ER_PROV]), T0.[CardCode], T4.ItemName, T0.DocDate, T2.ItemCode, T3.CardName
    order by  T1.SlpName, convert(varchar(12), T0.[U_ER_PROV]), T0.CardCode, T0.DocDate, T2.ItemCode
    What I´d like to do is, grouping in Crystal Reports, the result of this query by Item Code, not by date. The problem I have is that I need users introduce "from date" to "end date" as incoming paramater.
    The way I am running it, for example  I have some results like:
    date                         Item Code               Total
    01/01/2009               4646_R2                  120 u20AC
    10/01/2009               4646_R2                  34 u20AC
    And I´d like to take something like this:
    Item code                       Total
    4646_R2                         154 u20AC
    Not grouping by date ......
    Is there any way to do this using this query in Crystal Reports?
    Thanks very much for your time.
    Miguel A. Velasco

    Hello all, thanks very much to  Raghavendra for his helpfully answer.
    I followed your coments and now the report is running fine.
    Thanks again for your help without expecting anything in return.
    Miguel Velasco

  • After enabling cellular data, i am receiving mails even if disable "use cellular data for mail", due to this data usage usage use is more, if we have fix please let me know

    Phone Model and OS
    Model - iphone 5
    IOS 8.0.2
    Problem Description
    After enabling cellular data, i am receiving mails even if we disable "use cellular data for mail", due to this data usage usage use is more, if we have fix please let me know.
    Steps:
    1. Enable Cellular Data
    2. Disable mail on "use cellular data for mail
    3. check whether mail is received or not
    tried multiple times and i am getting more billing amount because of data usage

    Mail isn't the only app using data. Turning it off there has no effect whatsoever on whether the rest of iOS or other apps you have installed. In fact most apps use data these days, at a minimum for Notifications and often for gameplay and other features.

  • How can i select some row from multiple row in the same group of data

    I want to select some row from multiple row in the same group of data.
    ColumnA        
    Column B
    1                  OK
    1                   NG
    2                   NG
    2                          NG
    3                          OK
    3                          OK
    I want the row of group of
    ColumnA if  ColumnB contain even 'NG'
    row , select only one row which  Column B = 'NG'
    the result i want = 
    ColumnA         Column B
    1                         NG
    2                   NG
    3                          OK
    Thank you

    That's some awful explanation, but I think this is what you were driving at:
    DECLARE @forumTable TABLE (a INT, b CHAR(2))
    INSERT INTO @forumTable (a, b)
    VALUES
    (1, 'OK'),(1, 'NG'),
    (2, 'NG'),(2, 'NG'),
    (3, 'OK'),(3, 'OK')
    SELECT f.a, MIN(COALESCE(f2.b,f.b)) AS b
    FROM @forumTable f
    LEFT OUTER JOIN @forumTable f2
    ON f.a = f2.a
    AND f.b <> f2.b
    GROUP BY f.a

  • Teradata database error when using a Universe-defined Date condition

    I have encountered an odd problem when connecting Crystal to a Universe.  There is a pre-defined Date condition built into the Universe that is defined as follows:
    @Select(Date\Week End Date)  >  @Select(Conditions\User Response Select Date week -28)  AND @Select(Date\Week End Date)  <=  @Select(Conditions\User Response Select Date)
    The filter is designed to retrieve a rolling 4 weeks of data.
    When I try and create and refresh a Crystal Report that includes this Date prompt, I get the following error:
    Failed to retrieve data from the database.
    Details: 22003:(ODBC Teradata Driver)(Teradata Database) A character string failed conversion to a numeric value.
    If I create the same query in a WebI report it works fine, but in Crystal the error is produced.  I have also tried constructing the same prompt and filter within Crystal rather than use the pre-built prompt but that did not work either.
    Does anyone have any experience or advice on this error?  I can't seem to find many related postings on this specific error.
    BO Enterprise XI 3.1 SP2 running on Windows 2008 Server R2
    Crystal Reports 2008 SP2 running on Windows XP SP3
    Universe is built on a Teradata 12 source
    Thanks!

    One item I found I had to do with Teradata was cast my date/time values to dates, otherwise I got weird errors like this. You say it's working in Web Intelligence, so this might not be the issue, but it is an easy thing to test.
    In the universe, change your end date definition to
    cast(table.end_date as date)
    and see if that helps.

  • Grouping of data based on user prompt having a list of dimensions

    Hi All,
    I have a requirement to be able to group data in OBIEE request or Dashboard based on user prompt selection.
    The prompt should list the Dimensions Available
    e.g.
    Dimensions: Product, Region, Employee
    Fact: Sales
    The report is to display sales total for the quarters of the current year.
    The user prompt should list the available dimensions (In this case - Location, Employee and Product).
    If I choose Product, the data is to be grouped by Products - Layout having a simple tabular grouping with Product names as Group headings.
    Similarly any other choice of Dimension from the prompt should group the data by that dimension and have the dimension values used in the group headings.
    How could we implement this? I understand this type of requirement (ability to choose dimension) is met in some OLAP reporting tools.
    I have used multiple views and the View Selector for similar requirements previously, but looking for a dynamic solution here.
    Any pointers or solution will be great.
    Thanks,
    Kiran
    Edited by: Kiran Kudumbur on Sep 8, 2009 5:43 PM
    Edited by: Kiran Kudumbur on Sep 9, 2009 12:42 PM
    Edited by: Kiran Kudumbur on Sep 10, 2009 2:26 PM

    Hi All,
    I used column view to address this requirement.
    Thanks,
    Kiran

  • TSQL query to calculate Count / Sum grouping by date on a Pivot Table

    Hi All
    I need help to group the pivot table output to group by dates and sum/count the values. I have a table like shown below.
    Date
    Student 
    Subject
    Hunt
    Marks
    18/02/2014
    Sam 
    Maths
    1
    20
    18/02/2014
    Sam 
    Maths
    1
    10
    18/02/2014
    Sam 
    Maths
    2
    30
    18/02/2014
    Luke
    Science
    1
    50
    17/02/2014
    Sam 
    Maths
    2
    50
    17/02/2014
    Luke
    Science
    2
    60
    16/02/2014
    Luke
    Science
    2
    20
    16/02/2014
    Luke
    Science
    3
    20
    I want to Group by dates and move the Hunt to columns calculating their counts and sum their marks too. Like given below.
    I wrote a pivot query like below but If i group it with dates and calculate the total marks it throws aggregate errors.
    Create Table Student_Log ([Date] datetime ,Student varchar (20), Subject varchar (20) ,Hunt int ,Marks int )
    Go
    INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-18 15:00:00.000','Sam ','Maths','1','20')
    INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-18 15:00:00.000','Sam ','Maths','1','10')
    INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-18 15:00:00.000','Sam ','Maths','2','30')
    INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-18 15:00:00.000','Luke','Science','1','50')
    INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-17 15:00:00.000','Sam ','Maths','2','50')
    INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-17 15:00:00.000','Luke','Science','2','60')
    INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-16 15:00:00.000','Luke','Science','2','20')
    INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-16 15:00:00.000','Luke','Science','3','20')
    Go
    select * from Student_Log
    select [DATE] , [Student], [Subject] ,[1],[2],[3],[4],Total =([1]+[2]+[3]+[4])
    from
    ( select [Date], [Student], [Subject],[Hunt],[Marks] from Student_Log
    )x
    pivot
    count ( [Hunt]) for [Hunt]
    in ([1],[2],[3],[4])
    )p
    order by [Date] desc
    I have done this far only. More than this I need to enhance it with the Percentage of Hunts for each Student.
    ie like below table.
    On 18th Sam in Maths he had 2 rows on 1st hunt  and 1 row on 2nd hunt. So On the Pivot table is it possible to represent it on percentage using the Total Attempts column.
    Thanks a lot in advance.
    Its runnung in SQL 2000 Server.

    Create Table Student_Log ([Date] datetime ,Student varchar (20), Subject varchar (20) ,Hunt int ,Marks int )
    Go
    INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-18 15:00:00.000','Sam ','Maths','1','20')
    INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-18 15:00:00.000','Sam ','Maths','1','10')
    INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-18 15:00:00.000','Sam ','Maths','2','30')
    INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-18 15:00:00.000','Luke','Science','1','50')
    INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-17 15:00:00.000','Sam ','Maths','2','50')
    INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-17 15:00:00.000','Luke','Science','2','60')
    INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-16 15:00:00.000','Luke','Science','2','20')
    INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-16 15:00:00.000','Luke','Science','3','20')
    Go
    select * from Student_Log
    ;with mycte as
    Select [Date], [Student], [Subject] ,
    Count(CASE WHEN [Hunt]=1 Then Hunt End) as Hunt1,
    Count(CASE WHEN [Hunt]=2 Then Hunt End) as Hunt2,
    Count(CASE WHEN [Hunt]=3 Then Hunt End) as Hunt3,
    Count(CASE WHEN [Hunt]=4 Then Hunt End) as Hunt4,
    Count(CASE WHEN [Hunt]=1 Then Hunt End)
    +Count(CASE WHEN [Hunt]=2 Then Hunt End)
    +Count(CASE WHEN [Hunt]=3 Then Hunt End)+
    +Count(CASE WHEN [Hunt]=4 Then Hunt End) as Total,
    ISNULL(SUM(CASE WHEN [Hunt]=1 Then Marks End),0) as Mark1,
    ISNULL(SUM(CASE WHEN [Hunt]=2 Then Marks End),0) as Mark2,
    ISNULL(SUM(CASE WHEN [Hunt]=3 Then Marks End),0) as Mark3,
    ISNULL(SUM(CASE WHEN [Hunt]=4 Then Marks End),0) as Mark4
    from Student_Log
    Group By [Date], [Student], [Subject]
    Select [Date], [Student], [Subject]
    , Cast(Hunt1*1./Total*100 as int) as [1]
    , Cast(Hunt2*1./Total*100 as int) as [2]
    ,Cast(Hunt3*1./Total*100 as int) as [3]
    ,Cast(Hunt4*1./Total*100 as int) as [4]
    ,Total,Marks=( Mark1+Mark2+Mark3+Mark4)
    from mycte
    order by [Date] DESC, Student desc
    drop table Student_Log

  • Grouping of Individual groups of Data Template in the RTF

    Hi All,
    We have a scenario where we may require the grouping of Individual groups of Data Template in the RTF.
    Lets say
    1. I have group of Invoices with the Group Name G_INV
    2. I have a list of Payments done for the Invoices under G_PAY
    3. I also have a list of Prepayment Applications that are happened on the Invoices G_PRE
    All the three groups G_INV, G_PAY, and G_PRE are independent and they are at same level
    G_INV (Main Header)
    G_PAY (Main Header)
    G_PRE (Main Header)
    Extract
    <ROOT>
    <G_INV>
    <INV>I1</INV>
    </G_INV>
    <G_INV>
    <INV>I2</INV>
    </G_INV>
    <G_INV>
    <INV>I3</INV>
    </G_INV>
    <G_PAY>
    <PAY>P1</PAY>
    <INV>I1</INV>
    </G_PAY>
    <G_PAY>
    <PAY>P2</PAY>
    <PAYINV>I2</PAYINV>
    </G_PAY>
    <G_PRE>
    <PRE>PRE1</PRE>
    <PREINV>I1</PREINV>
    </G_PRE>
    </ROOT>
    But in the Report output,
    we need the data to be displayed as follows
    G_INV (Main Header)
    G_PAY (Sub Group of Payments)
    G_PRE (Sub Group of Prepayments)
    Output
    I1
    P1
    PRE1
    I2
    P2
    I3
    So, Can you please suggest us,
    Whether we can get these Individual groups into the above required hierarchical manner. If so, please let us know how to achieve the same.
    Also, it will be great if you advice us regarding the Performance, how best will be if we group the queries in this heirarchical manner in the RTF rather than getting the hardcoded dependency through linking of the Data Queries in the Data Template file.
    Thanks,
    Praveen G

    Hi
    I dont think you can stop the table growing using Word controls. The easiest way to do it would be to limit the amount of data coming in.
    <?for-each:LOOPELEMENT[position()<5]?>
    This is take only the first 5 rows
    Tim

  • Grouping of Data in Advanced Datagrid

    Hii,
    I need to group the data in advanced datagrid. I used the Grouping collection class, but it it not working.
    My advanced datagrid has column groups...so will this have any impact on grouping.
    Thanks!!
    Vikas

    Assuming that the table (say WALK_IN_PER_LOG) that you have has atleast the following two columns
    walk_in_date DATE -- holds date time stamp
    dob DATE -- holds date of birth
    SELECT TO_CHAR(walk_in_date,'WW')&#0124; &#0124;'-'&#0124; &#0124;TO_CHAR(walk_in_date,'DAY') "Week#-Day"
    ,TO_CHAR(TRUNC(TO_CHAR(walk_in_date,'HH24')/02),'09')&#0124; &#0124;'-'&#0124; &#0124;
    TO_CHAR(TRUNC(TO_CHAR(walk_in_date,'HH24')/02)+2,'09')
    ,COUNT(*)
    FROM walk_in_per_log
    WHERE MONTHS_BETWEEN(SYSDATE,dob) > 18*12
    GROUP BY TO_CHAR(walk_in_date,'WW')&#0124; &#0124;'-'&#0124; &#0124;TO_CHAR(walk_in_date,'DAY')
    ,TO_CHAR(TRUNC(TO_CHAR(walk_in_date,'HH24')/02),'09')&#0124; &#0124;'-'&#0124; &#0124;
    TO_CHAR(TRUNC(TO_CHAR(walk_in_date,'HH24')/02)+2,'09')
    PS I might have complicated the query a little in trying to get the formatting as you had requested but the principle is simple
    First group by the day, so that all events of one day can be compared together, then extract the hour portion of each of those dates and divide by 2 and use the quotient of the division as a grouping factor.
    eg
    from hours
    00-02 the quotient is 0 (2 is taken as 1:59:59)
    02-04 the quotient is 1 (4 is taken as 3:59:59)
    and so on
    hope this helps....

  • Grouping the data

    Hello team,
    I have come up with a question at my work.
    I have a table that has several fields. When I group the data with one field, I get some counts which are equal to the original count of field before grouping. As I add more fields to the query and I add to my grouping, the my total count wouldn't be equal
    to the original count of the column.
    Can somebody please this?
    What query can take care of this?
    I generated this select statement, but it didn't work.
    SELECT DISTINCT c.code, c.Approved, Year(b.Date) AS [Year], Month(b.Date) AS [Month]
    FROM (SELECT a.Code, Sum(a.Approved) AS Approved FROM [MyTable1] AS a WHERE (((a.Approved)>0)) GROUP BY a.Code) 
    AS c INNER JOIN [MyTable2] AS b ON c. code = b. Code;
    Regards,
    GGGGGNNNNN
    GGGGGNNNNN

    Hi GGGGGNNNNN,
    I am not bale to understand the count of field means. Did it mean the numbers of records? If I understand correctly, I think the result is expected since the group by clause is changed.
    Here are some articles about SQL in Access for your reference:
    SELECT Statement (Microsoft Access SQL)
    GROUP BY Clause (Microsoft Access SQL)
    Regards & Fei
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to show 2 groups of data in 1 XY plot at different time?

    Hi, all:
    I have a question and hope someone can help me figure out the solution or whether or not no solution for the question. I need to collect 2 groups of data [x(n),y(n)] and [x(n),z(n)]. I will collect x-y first then x-z. I need to collect and show the x-y data first, when I am satisfied, then collect and show the x-z data. It should be in the same plot. I got an error message so far and cold not figure out the solution. I attached my code and hope someone can help me. The code is in version 8.0 and I am sure there is no virus. Thank you a lot in advance.
    Attachments:
    plots.vi ‏13 KB

    Hello ccyang
    When you look the context help of the xy-graph in the diagram, you see the supported data types. An array of xy-clusters is accepted. You may look in the attached code how you could built the array  of the two plots.
    Check the example VIs included in LabVIEW (in the help menu). There are several examples on charts and graphs.
    Greetings
    shb
    Attachments:
    plots executable.vi ‏15 KB

Maybe you are looking for