DistinctValues and GroupBy
Hi,
I have the following code fragment to get distinct portfolios
Tangosol.Util.Aggregator.DistinctValues dv=new Tangosol.Util.Aggregator.DistinctValues("getPtf");
Object [] ports = (Object [])cachePos.Aggregate(AlwaysFilter.Instance, dv);
where cachePos
I am using the Coherence .Net.
What should I do if I want the distinct values on the following columns, portfolio, product and currency which have methods like getPrd, getCcy etc.
which should yield a Object[] portsprdscurr (each row of which is a triple)
Is there a way to do it with distinct values to create a multi column aggregator? Something similar to select statements
like
select portfolio,product,currency from position group by portfolio,product,currency
or
select distinct portfolio,product,currency from position
Thanks,
Vipin
Hi Vipin,
I think that you could write a custom Extractor that extracts portfolio, product, and currency from your cached object.
Then pass your custom extractor into the aggregator ...
Tangosol.Util.Aggregator.DistinctValues dv=new Tangosol.Util.Aggregator.DistinctValues(new MyExtractor());
--Tom
Similar Messages
-
Oracle report parameters- please help
iam working on reports 2.5 and oracle DB7.3.
In a report parameter in order to retrive the parameters i gave
a query as
select docno from docket where status='A'
for some period it has worked well.
may be as the number of transactions have increased the report
parameter form is not gettign loaded and when i click the report
it gives me r25srv error.
i could get rid of this error by restricting the parameters
pertaining only to 2001 documents.
the report is working but i have limited the trasactions here
and the problem has been solved temporarily.
my question is
1) does the parameter field takes limited no of transactions.?
if so what is limit to the parmeters.
this i am asking the reason is i found some docnos got displayed
latter i could view only junck characters in the parameter drop
down list. This could view only once.all the time it gives
r25srv error
2) how can i retrive all the docnos in the parameter other than
the above query.
please help mehello Thiru
thank u for ur help.
here i donot find necessity of using Distinct and groupby clause.
as the docnos are unique in the table i was referring,further
iam not using any function so as to use groupby clause.
Ofcourse i will try with LOV by calling reports from forms.
This particular table contains 12000 records ,each record has 1
doc no assigned to it.That means i want all the 12000 docs to be
viewed in the parameter so that i can select one doc no to view
that particular report.
regards -
H:selectBooleanCheckbox valuechangelistener help
Hi all,
I have a page with a dataTable that holds information about sales items. On the first visit to the page, the table is displayed normally and sorted by price. It takes a Result as its collection so any sorting is done in SQL. I want to support grouping the items by quantity as well so I used the t:dataTable component and specified a groupBy column. Outside of the table, I have an h:selectBooleanCheckbox that has a value of myBean.groupByQuantity, a valueChangeListener, and an onchange="this.form.submit()". The groupByQuantity boolean is also used in the t:column as the groupBy value. The value change listener checks the value of the groupByQuantity boolean and runs an appropriate query (to order by price or quantity).
Some relevant code:
<t:dataTable value="#{myBean.items}" var="item" groupByStyle="groups">
<t:column>
<t:column groupBy="#{myBean.groupByQuantity}">
<h:outputText value="#{item.quantity}"/>
</t:column>
</t:dataTable>
<h:selectBooleanCheckbox value="#{myBean.groupByQuantity}"
valueChangeListener="#{myBean.processValueChangeEvent}"
onclick="this.form.submit()"/>In the MyBean.java
public class MyBean{
private boolean groupByQuantity = false;
//getters and setters for groupByQuantity
public void processValueChangeEvent(ValueChangeEvent vce){
if (!groupByQuantity){
//run SQL to order by quantity
}else{
//run SQL to order by price
public String goBackToList(){
//run SQL to order by price
groupByQuantity = false;
}When using the checkbox to toggle the value of groupByQuantity, the code acts as expected (except for the fact that it seems as if the checkbox is submitting the opposite value as it should which is why the two have to be reversed). However, if a user leaves the page and comes back using the goBackToList method, the checkbox keeps whatever state it was in when the application navigated away from the page even though I explicitly set the value to false and secondly, if the value was true then the application runs the query to order by price but the group by style is being displayed but if it is false, the query to run the order by quantity is run and the group by style is not displayed.
Having this information, I can see two problems but do not understand why they are happening. The first is that when I navigate to the page, the valueChangeListener event is being called even though I have not touched the checkbox. This must be happening because that method is the only place where there is a query to order by quantity. The other problem is that the value that is getting submitted to the backing bean and the value that is being reflected by the checkbox and groupBy attributes are not the same value. Has anyone had a similar problem? Does anyone have any advice on how to fix this?
Thanks in advance,
JRHi all,
I have a page with a dataTable that holds information about sales items. On the first visit to the page, the table is displayed normally and sorted by price. It takes a Result as its collection so any sorting is done in SQL. I want to support grouping the items by quantity as well so I used the t:dataTable component and specified a groupBy column. Outside of the table, I have an h:selectBooleanCheckbox that has a value of myBean.groupByQuantity, a valueChangeListener, and an onchange="this.form.submit()". The groupByQuantity boolean is also used in the t:column as the groupBy value. The value change listener checks the value of the groupByQuantity boolean and runs an appropriate query (to order by price or quantity).
Some relevant code:
<t:dataTable value="#{myBean.items}" var="item" groupByStyle="groups">
<t:column>
<t:column groupBy="#{myBean.groupByQuantity}">
<h:outputText value="#{item.quantity}"/>
</t:column>
</t:dataTable>
<h:selectBooleanCheckbox value="#{myBean.groupByQuantity}"
valueChangeListener="#{myBean.processValueChangeEvent}"
onclick="this.form.submit()"/>In the MyBean.java
public class MyBean{
private boolean groupByQuantity = false;
//getters and setters for groupByQuantity
public void processValueChangeEvent(ValueChangeEvent vce){
if (!groupByQuantity){
//run SQL to order by quantity
}else{
//run SQL to order by price
public String goBackToList(){
//run SQL to order by price
groupByQuantity = false;
}When using the checkbox to toggle the value of groupByQuantity, the code acts as expected (except for the fact that it seems as if the checkbox is submitting the opposite value as it should which is why the two have to be reversed). However, if a user leaves the page and comes back using the goBackToList method, the checkbox keeps whatever state it was in when the application navigated away from the page even though I explicitly set the value to false and secondly, if the value was true then the application runs the query to order by price but the group by style is being displayed but if it is false, the query to run the order by quantity is run and the group by style is not displayed.
Having this information, I can see two problems but do not understand why they are happening. The first is that when I navigate to the page, the valueChangeListener event is being called even though I have not touched the checkbox. This must be happening because that method is the only place where there is a query to order by quantity. The other problem is that the value that is getting submitted to the backing bean and the value that is being reflected by the checkbox and groupBy attributes are not the same value. Has anyone had a similar problem? Does anyone have any advice on how to fix this?
Thanks in advance,
JR -
How to identify a One time Customer in Oracle Apps AR
Hello,
How to identify a One time Customer In Oracle APps AR?
Is it possible to find out how many number of transactions a Customer does so that, if the number of transactions is 1, then that customer is a one time customer. or else he is not?
Thank you
BobHi Bob,
to my knowledge, i cannot recollect a seeded report from oracle that could meet your requirement. You can try running the Transaction Register report from your Go live date till now, so that system would generate a list of all the Invoices along with the Customer Name, then you could export this to excel and perform a sort, filter and groupby to get the desired result ....
However if you are a person with technical expertise, check the table RA_CUSTOMER_TRX_ALL this stores all the transaction related information ..... you can select TRX_NUMBER, BILL_TO_CUSTOMER_ID from this table and perform a count by customer...(I am not sure on the syntax and usage of sql functions) you can get the desired results ...
Also in future, while creating a new customer if you know well in advance that this customer is going to be an ONE TIME CUSTOMER, there you could capture that information in any unused field on the customer configuration or can enable a DFF and capture this information, so it becomes very easy to identify such customers or have a report built based on it...
I assume there is an objecive behind trying to find One time customers or customers with a single transaction history ... are you planning to disable/end date/inactivate such customers ....?
Regards,
Ivruksha -
Oracle Report Manager - Please help
Just a quick question for anyone familiar with this product. We have Oracle Applications/Financials 16.1, 10.7 SC and run on DG-UX. It looks like Report Manager is only available for NT and Solaris.... will the Solaris version work on the DG-UX platform as well?
Thanks in advance,
Dariushello Thiru
thank u for ur help.
here i donot find necessity of using Distinct and groupby clause.
as the docnos are unique in the table i was referring,further
iam not using any function so as to use groupby clause.
Ofcourse i will try with LOV by calling reports from forms.
This particular table contains 12000 records ,each record has 1
doc no assigned to it.That means i want all the 12000 docs to be
viewed in the parameter so that i can select one doc no to view
that particular report.
regards -
Some hierarchy related issues, SQL Query is including unselected columns?
Hello Guys...
I have something strange happening in my report.. First of all, the RPD I have is built according to JDE model.
There is a schema which looks like this:
BU Dim ------->Fact<---------Account Dim <--------BU Account Dim (Indeed a copy of BU Dim)
A dim hierarchy is created as AccountDim with Account Desc at the lowest bottom level, the dimension key at that level is AcctID which is the unique identifier.
The issue comes when I created a report using Account, Account Desc, Fact Measures. The measures are not displayed as per account even if the joins and aggr levels are all defined correctly at the proper level..
I checked the sql that is generately, it is interested that whenever I include Account Desc column in the report, the SQL will include Actid column in the select and groupby part, which results in data being at the wrong level..
When I remove Actid from Account Hierarchy as the key, the report runs correctly and the SQL query won't include Actid column.. However, since the removal of the ACTid key from Account Hierarchy will cause other reports not running properly, I have to revert the change back to normal.. I'd like to know what to do in order to investigate more deeply as what's going on and as why the SQL will include columns fields that are not selected at answer levels..
Any suggestions will be greatly appreciately.. I'd like to provide the rpd file, but not sure how to..
Many ThanksHi, Vikeng,
Why use the salary table at all, if you're not ever getting any information from it?
Why not:
SELECT EmpName
, DeptName
, 'N/A' AS SalaryValue
FROM Employee
, Department
WHERE Employee.EmployeeId = Department.EmployeeId
Are you saying that somethimes there is a relationship, but not with this sample data?
If so, post some different sample data (CREATE TABLE and INSERT statements) that has a relationship for some rows, and not for others. Post the results you want from that data, and explain, with specific examples, how you get those results from that data.
You might just need an outer join. -
Which group by function to use in following case?
Table name: PVH
| Processid | Name | Timechanged | Value |
| 268436769 | filecount | 10/1/2008 2:59:01.006000 AM | 0 |
| 268436769 | filecount | 10/1/2008 2:45:33.004000 AM | 100 |
I want "value" where max(timechanged) and groupby appianprocessid and name …… that is "0"
How to get that using simple SQL? I tried following two approaces….
Select max(timechanged), value from pvh where appianprocessid=268436769 group by appianprocessid, name, value
This query returns me two values...
Select max(timechanged), max(value) from pvh where appianprocessid=268436769 group by appianprocessid, name
This
Thanks
SandeepHello,
Try:
SELECT name, value, timechanged
FROM PVH p1
WHERE timechanged = (
SELECT MAX(timechanged)
FROM PVH p2
WHERE p1.appianprocessid = p2.appianprocessid)
WHERE appianprocessid = 268436769 ;Edited by: SeánMacGC on Jul 14, 2009 2:55 PM
And another way:
SELECT name, value, timchanged
FROM (
SELECT name, value, timechanged,
ROW_NUMBER() OVER (PARTITION BY appianprocessid ORDER BY timechanged DESC) row_num
FROM PVH)
WHERE appianprocessid = 268436769
AND row_num <= 1;And if the timechanged can have duplicate values for each appianprocessid, and you want all rows with the same MAX(appianprocessid), change ROW_NUMBER to RANK in that second query. -
GroupAggregator and DistinctValues woes
Hi --
I have crafted a contrived TestCase and I just can't get the thing to output the results I expect.
Posting the classes (TestCase/Person), followed by the output I get, followed by the output I would have thought I should get.
Running on Mac OS 10.5.5, single node, stock configuration (not specified a custom XML config file) and the TestCase class is run with local storage set to false. Using the 3.4 download I picked up yesterday from the Oracle site; we also use 3.4 at work.
Any help appreciated!
----------8<----------------------------8<-------------------------------
// TestCase.java - the main class
package org.foo;
import com.tangosol.net.CacheFactory;
import com.tangosol.net.NamedCache;
import com.tangosol.util.NullFilter;
import com.tangosol.util.aggregator.DistinctValues;
import com.tangosol.util.aggregator.GroupAggregator;
public class TestCase {
public static void main(String[] args) {
// get a stock cache - no custom config
NamedCache cache = CacheFactory.getCache("theCache");
cache.clear();
// add some people to the cache
cache.put(1, new Person(1, "Albert"));
cache.put(2, new Person(2, "Albert"));
cache.put(3, new Person(3, "Albert"));
cache.put(4, new Person(4, "Cindy"));
// i want to find the id's of employees who share the same name, so i group by name
GroupAggregator ga = GroupAggregator.createInstance("getName", new DistinctValues("getId"));
// do the aggregation
Object result = cache.aggregate(new NullFilter(), ga);
// dump the result
System.out.println(result);
----------8<----------------------------8<-------------------------------
package org.foo;
import java.io.Serializable;
public class Person implements Serializable {
private int id;
private String name;
public Person(int id, String name) {
this.id = id;
this.name = name;
public int getId() {
return id;
public String getName() {
return name;
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + id;
return result;
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Person other = (Person) obj;
if (id != other.id)
return false;
return true;
----------8<----------------------------8<-------------------------------
ACTUAL OUTPUT: {Cindy=[3, 1, 2], Albert=[3, 1, 2]}
EXPECTED OUTPUT: {Cindy=[4], Albert=[3, 1, 2]}
----------8<----------------------------8<-------------------------------Hi good stuff,
If will work as expected if you change your TestCase to
// i want to find the id's of employees who share the same name, so i group by name
GroupAggregator ga = GroupAggregator.createInstance("getName", new MyDistinctValues("getId"));where MyDistinctValues is
import com.tangosol.util.ValueExtractor;
import com.tangosol.util.aggregator.DistinctValues;
import java.util.Set;
import java.util.HashSet;
import java.util.Collection;
* dimitri Oct 6, 2008 12:50:08 AM
public class MyDistinctValues extends DistinctValues
public MyDistinctValues()
super();
public MyDistinctValues(ValueExtractor extractor)
super(extractor);
public MyDistinctValues(String sMethod)
super(sMethod);
public Object aggregate(Set setEntries)
Set setResults = (Set) super.aggregate(setEntries);
return new HashSet(setResults);
public Object aggregateResults(Collection collResults)
Set setResults = (Set) super.aggregateResults(collResults);
return new HashSet(setResults);
}Regards,
Dimitri -
Sum and group by using CAML query
Is there any way to get the SUM of values with group by ID using CAML query?
I have a custom list, in that I have ID and Value columns as below
ID Value1 Value2
1 10 4
2 5 3
1 15 2
3 20 1
I want to get result:
ID Value1 Value2
1 25 6
2 5 3
3 20 1
I used CAML query:
<View>
<Query>
<Where>
<IsNotNull>
<FieldRef Name="ID" />
</IsNotNull>
</Where>
<GroupBy Collapse="FALSE">
<FieldRef Name="ID" />
</GroupBy>
</Query>
<ViewFields>
</ViewFields>
<Aggregations Value="On">
<FieldRef Name="Value1" Type="SUM" />
<FieldRef Name="Value2" Type="SUM" />
</Aggregations>
</View>
But
this query returns all the records
that satisfy the condition <Where>.
I
do not correctly?You need to work with current view based aggregation. Please check below threads for your reference.
http://social.msdn.microsoft.com/Forums/sharepoint/en-US/dda5735a-fecf-403f-9495-1b63617d2fbf/question-on-a-caml-query?forum=sharepointdevelopmentlegacy
http://social.msdn.microsoft.com/Forums/sharepoint/en-US/24e88d6a-ee15-4d81-a5fe-504c7bd14e46/how-to-sum-a-column-value-using-caml-query?forum=sharepointdevelopment
Hope this helps.
My Blog- http://www.sharepoint-journey.com|
If a post answers your question, please click Mark As Answer on that post and Vote as Helpful
I've seen these
issues and articles and do them, but
does not work. I use object mozhel
Sharepoint (javascript). -
Range Filter Mode not working and throws error in Power View (SharePoint 2013)
Hi,
I am using two filters in my power view report.
One for the contact type group and one for year.
First I select multiple contact type group for the first filter and everything works fine.
Then I try to select the year using the range filter and I get this error:
System.ArgumentException: The name 'Year' was specified twice, at index 0 and index 1. Duplicate names are not allowed.
Parameter name: keys[1]
at Microsoft.Data.Common.CommandTrees.ExpressionBuilder.Internal.EnumerableValidator`3.Validate(IEnumerable`1 argument, String argumentName, Int32 expectedElementCount, Boolean allowEmpty, Func`3 map, Func`2 collect, Func`3 deriveName)
at Microsoft.Data.Common.CommandTrees.ExpressionBuilder.Internal.EnumerableValidator`3.Validate()
at Microsoft.Data.Common.CommandTrees.ExpressionBuilder.Internal.ArgumentValidation.ValidateGroupBy(DbGroupExpressionBinding input, IEnumerable`1 keys, IEnumerable`1 aggregates, DbExpressionList& validKeys, ReadOnlyCollection`1& validAggregates)
at Microsoft.Reporting.QueryDesign.ExpressionTrees.ExpressionBuilder.Internal.QueryExpressionBuilder.GroupBy(QueryGroupExpressionBinding input, IEnumerable`1 groupItems, IEnumerable`1 aggregates)
at Microsoft.Reporting.QueryDesign.QueryDefinitionModel.Internal.QdmExpressionBuilder.QdmGroupBy(IEnumerable`1 expressions)
at Microsoft.Reporting.QueryDesign.QueryDefinitionModel.Internal.QdmExpressionBuilder.QdmFilter(IGrouping`2 predicates)
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at Microsoft.Reporting.QueryDesign.QueryDefinitionModel.Internal.QdmExpressionBuilder.QdmFilters(IEnumerable`1 filterConditions)
at Microsoft.Reporting.QueryDesign.QueryDefinitionModel.Internal.FilterQueryFactory.AddRowCount(QueryBuilder queryBuilder, Group group, EntitySet entity, IEnumerable`1 rowCountFilterContext)
at Microsoft.Reporting.QueryDesign.QueryDefinitionModel.Internal.FilterQueryFactory.CreateValueWithCountQuery(QueryBuilder queryBuilder, List`1 columns, IEdmFieldInstance fieldInstance, FilterCondition availableValueFilter, FilterCondition activeValueRetentionFilter,
GroupReference& groupRef)
at Microsoft.Reporting.QueryDesign.QueryDefinitionModel.Internal.FilterQueryFactory.CreateValueListQuery(EntityDataModel model, IEdmFieldInstance fieldInstance, Int32 topCount, FilterCondition availableValueFilter, FilterCondition activeValueRetentionFilter,
IEnumerable`1 exclusionPathSegments, ValueListQuerySchema& schema)
at Microsoft.Reporting.AdHoc.DataStructureManagement.Filtering.Internal.FilterValueQueryFactory.CreateFilterValuesQuery[TFilterMode](TFilterMode filterMode, Int32 maxRowCount, FormulaFilterCondition availableValueFilter, FormulaFilterCondition
activeValueRetentionFilter, ValueListQuerySchema& schema)
at Microsoft.Reporting.AdHoc.DataStructureManagement.Filtering.Internal.ListFilterMode.ListDataLoader.<LoadDataImpl>d__15.MoveNext()
at Microsoft.Reporting.AsyncEnumerator.AsyncEnumeratorBase.MoveNextChecked()
at Microsoft.Reporting.AsyncEnumerator.AsyncEnumeratorBase.ResumeIterator(Boolean synchronous)
at Microsoft.Reporting.AsyncEnumerator.AsyncEnumeratorBase.BeginExecuteCore(IEnumerator`1 asyncMethod)
at Microsoft.Reporting.AsyncEnumerator.AsyncEnumeratorImpl.BeginExecute(Func`2 asyncMethod)
at Microsoft.Reporting.AsyncEnumerator.BeginExecute(Func`2 asyncMethod, AsyncCallback userCallback, Object userState, AsyncEnumeratorSettings settings)
at Microsoft.Reporting.AdHoc.DataStructureManagement.Filtering.Internal.FilterMode.DataLoader`1.BeginLoadData(AsyncCallback userCallback, Object userState)
at Microsoft.Reporting.AdHoc.DataStructureManagement.Filtering.Internal.FilterMode.DataLoader`1.LoadDataAsync()
at Microsoft.Reporting.AdHoc.DataStructureManagement.Filtering.Internal.FieldFilter.LoadDataAsyncCore()
at Microsoft.Reporting.AdHoc.DataStructureManagement.Filtering.Internal.FilterManager.OnEditCompleted()
at Microsoft.Reporting.AdHoc.DataStructureManagement.Filtering.Internal.PageFilterManager.OnEditCompleted()
at Microsoft.Reporting.AdHoc.DataStructureManagement.Filtering.Internal.FilterManager.OnEditCompleted(EventArgs args)
at Microsoft.Practices.Prism.Events.EventSubscription`1.InvokeAction(Action`1 action, TPayload argument)
at Microsoft.Practices.Prism.Events.EventSubscription`1.<>c__DisplayClass2.<GetExecutionStrategy>b__0(Object[] arguments)
at Microsoft.Practices.Prism.Events.EventBase.InternalPublish(Object[] arguments)
at Microsoft.Practices.Prism.Events.CompositePresentationEvent`1.Publish(TPayload payload)
at Microsoft.Reporting.AdHoc.DataStructureManagement.Internal.TransactionManager.EditEventAggregator.Exit()
at Microsoft.Reporting.AdHoc.DataStructureManagement.Internal.TransactionManager.EditEventAggregator.SelectionManager_SelectionResumed(Object sender, EventArgs e)
at Microsoft.Reporting.Util.RaiseEvent(EventHandler eventHandler, Object sender, EventArgs eventArgs)
at Microsoft.Reporting.AdHoc.Shell.Regions.Canvas.Internal.SelectionManager.ResumeSelectionChanges()
at Microsoft.Reporting.AdHoc.Shell.Regions.Canvas.Internal.SelectionManager.<.ctor>b__3(Object s, EventArgs e)
at Microsoft.Reporting.Util.RaiseEvent(EventHandler eventHandler, Object sender, EventArgs eventArgs)
at Microsoft.Reporting.AdHoc.DataManagement.Internal.DataManager.set_HandleRdmChanges(Boolean value)
at Microsoft.Reporting.AdHoc.DataManagement.Internal.DataManager.UndoManager_SuspendRdmHandlingChanged(Object sender, StateChangedEventArgs`1 args)
at Microsoft.Reporting.Util.RaiseEvent[TEventArgs](EventHandler`1 eventHandler, Object sender, TEventArgs eventArgs)
at Microsoft.Reporting.AdHoc.Shell.Services.UndoManagement.Internal.UndoManager.<.ctor>b__0(Object sender, StateChangedEventArgs`1 args)
at Microsoft.Reporting.Util.RaiseEvent[TEventArgs](EventHandler`1 eventHandler, Object sender, TEventArgs eventArgs)
at Microsoft.Reporting.AdHoc.Shell.Services.UndoManagement.Internal.UndoManagerApiProperties.set_SuspendDataManagerRdmHandling(Boolean value)
at Microsoft.Reporting.AdHoc.Shell.Services.UndoManagement.Internal.UndoManagerHasOpenUndoGroupStateImpl.OnUndoGroupCommitting(UndoGroup undoGroup)
at Microsoft.Reporting.AdHoc.Shell.Services.UndoManagement.Internal.UndoManagerHasOpenUndoGroupStateImpl.HandleUndoGroupStateChanged(Object sender, EventArgs args)
at Microsoft.Reporting.Util.RaiseEvent(EventHandler eventHandler, Object sender, EventArgs eventArgs)
at Microsoft.Reporting.AdHoc.Shell.Services.UndoManagement.Internal.UndoGroup.HandleStateEnteredEvent(Object sender, EventArgs args)
at Microsoft.Reporting.Util.RaiseEvent(EventHandler eventHandler, Object sender, EventArgs eventArgs)
at Microsoft.Reporting.AdHoc.Shell.Services.UndoManagement.Internal.UndoGroupCommittingStateImpl.EnterState()
at Microsoft.Reporting.AdHoc.Shell.Services.UndoManagement.Internal.UndoGroup.SetState(UndoGroupStateImpl nextState)
at Microsoft.Reporting.AdHoc.Shell.Services.UndoManagement.Internal.UndoGroupOpenStateImpl.Commit()
at Microsoft.Reporting.AdHoc.Shell.Services.UndoManagement.Internal.UndoGroup.Commit()
at Microsoft.Reporting.AdHoc.DataStructureManagement.Internal.TransactionManager.CompleteTransaction(Transaction transaction, Boolean completedSuccessfully)
at Microsoft.Reporting.AdHoc.DataStructureManagement.Internal.TransactionManager.Transaction.Dispose()
at Microsoft.Reporting.AdHoc.DataStructureManagement.Internal.TransactionalObject.ExecuteInTransaction(Action action)
at Microsoft.Reporting.AdHoc.DataStructureManagement.Filtering.Internal.ValueAndOperatorConditionFilterMode.CreateRangeFilterCore(IList`1 rangeConditions)
at Microsoft.Reporting.AdHoc.DataStructureManagement.Filtering.Internal.NumericRangeFilterMode`1.CreateRangeFilter(FilterValueAndOperator[] rangeConditions)
at Microsoft.Reporting.AdHoc.Shell.Regions.Canvas.Internal.RangeFilterViewModel`1.<get_UpdateRangeBoundsCommand>b__0(Nullable`1 adjType)
at Microsoft.Practices.Prism.Commands.DelegateCommand`1.<>c__DisplayClass6.<.ctor>b__2(Object o)
at Microsoft.Practices.Prism.Commands.DelegateCommandBase.Execute(Object parameter)
at Microsoft.Practices.Prism.Commands.DelegateCommandBase.System.Windows.Input.ICommand.Execute(Object parameter)
at Microsoft.Reporting.Windows.Common.Internal.RangeSlider.FireCommand()
at Microsoft.Reporting.Windows.Common.Internal.RangeSlider.Thumb_DragCompleted(Object sender, DragCompletedEventArgs e)
at System.Windows.Controls.Primitives.Thumb.RaiseDragCompleted(Boolean canceled)
at System.Windows.Controls.Primitives.Thumb.OnLostMouseCapture(MouseEventArgs e)
at System.Windows.Controls.Control.OnLostMouseCapture(Control ctrl, EventArgs e)
at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName, UInt32 flags)
If I select List Filter mode and try to achieve this it works fine no issue but when I use range filter this weird problem occurs. Can't I select multiple values using Range Filter Mode ? Isn't that's what it is intended to do ? Is it a known bug ? Any kind
of prior experience or help would be much appreciated.
Vivek KamathThis looks like it could be a bug. You could file an issue at
http://connect.microsoft.com and include a repro. If this is blocking your business, you could also contact support services and if it is determined to be a defect in a Microsoft product, the support is free.
Brad Syputa, Microsoft Power BI This posting is provided "AS IS" with no warranties. -
can anyone xplain rollup and cube function in Groupby clause
Google "rollup and cube in oracle" or
http://www.psoug.org/reference/rollup.html
HTH
Girish Sharma -
Getting a list of users and permission from a folder including nested groups
$project_folder = "\\servername\foldername\foldername1"
Get-Acl $project_folder |
ForEach-Object {
$_.Access | Add-Member -MemberType NoteProperty -Name Path -Value $_.Path -PassThru
} |
ft -GroupBy Path -Property IdentityReference, AccessControlType, FileSystemRights > foldertst.csv
The above command gives me a list of all the users who have access to foldername1. (including users and groups).
How do i modify this code to get the information of the nested groups for this folderSorry, I won't be providing a complete solution, just a few suggestions and comments.
first thing will be to determine for each ACE (access control entry) whether the IdentityReference refers to a user account or a group. If a group, you will then need to process each of its members, each of which will share the FileSystemRights of the current
ACE.
But... if any of the members are other groups, you will need to process them recursively as well. Recursively.
There are a few gotcha's, though:
you need to recognize and avoid infinite recursion when, for example, group A is a member of group B which is a member of group A. One way to do this is to keep a list of all groups encountered, processing each only once.
if one ACE belongs to group C, another belongs to group D, group A is a member of C, and group B is a member of D, you must ensure that all members of A and B are listed with ACE C and ACE D.
Once you have identified all user accounts you might find that some have multiple records. For example, user AA might belong to group A, and get unlimited access through the ACE owned by group C, but deny read access through the ACE owned by group D. If
the first mention of this user in your output shows he has unlimited access, that will, of course be incorrect. at the very least the output should be sorted by username. You could attempt to amalgamate all of his various accesses (like the effective permissions
tab) into a single one. But it would be difficult to show which group memberships contributed which aspects of his access permissions in any kind of simple or intuitive way.
security configurations can easily become overly complex. The best solution is to simplify and standardize how permissions are applied and how groups are nested. I have had to do this on occasion, and the problem of determining how things should be permitted
from how they actually are is probably the most complicated part of the job.
good luck.
Al Dunbar -- remember to 'mark or propose as answer' or 'vote as helpful' as appropriate. -
Hello,
I am doing a project that uses MS Access to access data about a baseball team . The MS Access Database provides the names, addresses, and age of the players. All the players are 12, 13, or 14 years old. I need to display the average age for the team on a
label, which was easy. The problem is that I also have to display the number of players who are 12, 13, and 14 years old and I have no idea how to do that.
Here is my code so far:
Public Class frmBaseball
Private Sub TeamBindingNavigatorSaveItem_Click(sender As Object, e As EventArgs) Handles TeamBindingNavigatorSaveItem.Click
Me.Validate()
Me.TeamBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.LittleLeagueDataSet)
End Sub
Private Sub frmBaseball_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'LittleLeagueDataSet.Team' table. You can move, or remove it, as needed.
Me.TeamTableAdapter.Fill(Me.LittleLeagueDataSet.Team)
End Sub
Private Sub btnAges_Click(sender As Object, e As EventArgs) Handles btnAges.Click
Dim strSql As String = "SELECT * FROM Team"
Dim strPath As String = "Provider=Microsoft.ACE.OLEDB.12.0 ;" & "Data Source=e:\LittleLeague.accdb"
Dim odaTeam As New OleDb.OleDbDataAdapter(strSql, strPath)
Dim datAge As New DataTable
Dim intCount As Integer = 0
Dim intTotalAge As Integer
Dim decAverageAge As Decimal
odaTeam.Fill(datAge)
odaTeam.Dispose()
For intCount = 0 To datAge.Rows.Count - 1
intTotalAge += Convert.ToInt32(datAge.Rows(intCount)("Age"))
decAverageAge = Convert.ToDecimal(intTotalAge / datAge.Rows.Count)
Next
lblAverage.Visible = True
lblAverage.Text = "The average age of the team is " & decAverageAge.ToString("N2")
lbl12.Text = "The number of 12 year olds is "
lbl13.Text = "The number of 13 year olds is "
lbl14.Text = "The number of 14 year olds is "
lbl12.Visible = True
lbl13.Visible = True
lbl14.Visible = True
End Sub
End Class
I think I should use a For..Next loop but I don't know how to identify and match using this database, and then count how many repeated 12, 13, 14 years old there are.
Any help would be really appreciated.Hello,
Conceptually speaking you would group the data and count. Beings this is school work the demo below is a static example and not suitable for your assignment, its to show a point. Now if you have learned about LINQ and Lambda this logic can apply to your
question but need to work out using this your data which can be done. If not look at using SQL Grouping.
Example of SQL grouping and count
select country, count(country) as count from customers group by country
Module Module1
Public Sub GroupingDemo()
Dim dt As DataTable = SimulateLoadFromDatabase()
Dim TeamData = dt.AsEnumerable.GroupBy(
Function(student) student.Field(Of Integer)("Age")) _
.Select(Function(group) New With
Key .Value = group.Key,
Key .Info = group.OrderByDescending(
Function(x) x.Field(Of String)("Name"))}) _
.OrderBy(
Function(group) group.Info.First.Field(Of Integer)("age"))
Dim dictData As New Dictionary(Of String, String)
For Each group In TeamData
Console.WriteLine("Group: {0} count: {1} ", group.Value, group.Info.Count)
dictData.Add(group.Value.ToString, group.Info.Count.ToString)
' The following is not needed but good to show
For Each item In group.Info
Console.WriteLine(" {0} {1}",
item.Field(Of Integer)("Identifier"),
item.Field(Of String)("Name"))
Next
Next group
Console.WriteLine()
Console.WriteLine("This data can be used to populate control text")
For Each Item As KeyValuePair(Of String, String) In dictData
Console.WriteLine("{0} {1}", Item.Key, Item.Value)
Next
End Sub
Private Function SimulateLoadFromDatabase() As DataTable
Dim dt As New DataTable With {.TableName = "MyTable"}
dt.Columns.Add(New DataColumn With {.ColumnName = "Identifier", .DataType = GetType(Int32),
.AutoIncrement = True, .AutoIncrementSeed = 1})
dt.Columns.Add(New DataColumn With {.ColumnName = "Name", .DataType = GetType(String)})
dt.Columns.Add(New DataColumn With {.ColumnName = "Age", .DataType = GetType(Int32)})
dt.Rows.Add(New Object() {Nothing, "Bill", 13})
dt.Rows.Add(New Object() {Nothing, "Karen", 14})
dt.Rows.Add(New Object() {Nothing, "Jim", 13})
dt.Rows.Add(New Object() {Nothing, "Paul", 15})
dt.Rows.Add(New Object() {Nothing, "Mike", 14})
dt.Rows.Add(New Object() {Nothing, "Jill", 13})
Return dt
End Function
End Module
Output in the IDE output window
Group: 13 count: 3
3 Jim
6 Jill
1 Bill
Group: 14 count: 2
5 Mike
2 Karen
Group: 15 count: 1
4 Paul
This data can be used to populate control text
13 3
14 2
15 1
Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. -
Passing where and group by clause to cursor
I am working on a procedure that builds a where clause and needs a group by clause to return the correct results. I am trying to pass both the where and group by variables into the cursor.
The variables are getting populated correctly, but when the cursor gets created, the variables are not in the cursor.
Here is the code I'm working with. It is a part of a package, but makes no calls to other parts of the package.
PROCEDURE createFollowUpTask_Exposure( psUppgkedjetyp IN tis.tial.uppgkedjetyp%TYPE default NULL,
psAlarmtyp IN tis.tial.alarmtyp%TYPE default NULL,
psSubtyp IN tis.tial.subtyp%TYPE default NULL,
pnDays IN NUMBER default NULL,
psKampkod IN tis.tiin.kampkod%TYPE default NULL,
psKatnr IN tis.tiin.katnr%TYPE default NULL,
psUtgava IN tis.tiin.utgava%TYPE default NULL,
psKatslag IN tis.tikg.katslag%TYPE default NULL,
psProdsyst IN tis.tikg.prodsyst%TYPE default NULL,
psUppgtyp IN tis.tiin.uppgtyp%TYPE default NULL,
psProdkod IN tis.tiin.prodkod%TYPE default NULL,
psStatus IN tis.tiin.status%TYPE default NULL
) AS
cTIAL tis.tial%ROWTYPE;
vLopnr tis.tial.lopnr%TYPE;
vSqlWhere VARCHAR2(4000);
vGroupBy VARCHAR2(1000) := ' tiin.kampkod, tiin.abnr, tiko.fordsalj';
cSelectCursor SYS_REFCURSOR;
vSqlSelect VARCHAR2(4000);
psDays VARCHAR2(50);
cRec T_TIAL_REC;
nCount number := 0;
CURSOR cSqlSelect( SqlWhere IN VARCHAR2, GroupBy IN VARCHAR2) IS
SELECT tiin.kampkod, tiin.abnr, tiko.fordsalj, MAX(tici.regdat) ALARMDATE
FROM tis.tiin
JOIN tis.tiko ON tiin.kampkod = tiko.kampkod AND tiin.abnr = tiko.abnr
JOIN core.tici ON tiin.kampkod = tici.kampkod AND tiin.abnr = tici.abnr AND tici.inplnr = tiin.inplnr
WHERE 1=1 || SqlWhere
GROUP BY GroupBy;
BEGIN
-- If these parameters are null, raise error
IF psUppgkedjetyp IS NULL and psSubtyp IS NULL THEN
raise_application_error(-20001,
'Either Event Chain or Starting Event must be assigned');
END IF;
-- Populate TIAL values
IF psUppgkedjetyp IS NOT NULL THEN
cTIAL.Uppgkedjetyp := psUppgkedjetyp;
END IF;
IF psAlarmtyp IS NOT NULL THEN
cTIAL.Alarmtyp := psAlarmtyp;
END IF;
cTIAL.Handklass := 'T';
cTIAL.Blobid := 0;
IF pnDays IS NOT NULL THEN
psDays := '+ '||pnDays;
END IF;
IF psSubtyp IS NOT NULL THEN
cTIAL.Subtyp := psSubtyp;
END IF;
-- Create Where clause for cursor
vSqlWhere := '';
IF psKampkod IS NOT NULL THEN
vSqlWhere := vSqlWhere||' AND tiin.kampkod = '''|| psKampkod||'''';
END IF;
IF psKatnr IS NOT NULL THEN
vSqlWhere := vSqlWhere||' AND tiin.katnr = '''||psKatnr||'''';
END IF;
IF psUtgava IS NOT NULL THEN
vSqlWhere := vSqlWhere||' AND tiin.utgava = '''||psUtgava||'''' ;
END IF;
IF psKatslag IS NOT NULL THEN
vSqlWhere := vSqlWhere||' AND tikg.katslag = '''||psKatslag||'''';
END IF;
IF psProdsyst IS NOT NULL THEN
vSqlWhere := vSqlWhere||' AND tikg.prodsyst = '''||psProdsyst||'''';
END IF;
IF psUppgtyp IS NOT NULL THEN
vSqlWhere := vSqlWhere||' AND tiin.uppgtyp = '''||psUppgtyp||'''';
END IF;
IF psProdkod IS NOT NULL THEN
vSqlWhere := vSqlWhere||' AND tiin.prodkod = '''||psProdkod||'''';
END IF;
IF psStatus IS NOT NULL THEN
vSqlWhere := vSqlWhere||' AND tiin.status = '''||psStatus||'''';
END IF;
-- Loop through all records meeting input parameters and set required TIAL values.
FOR i IN cSqlSelect(vSqlWhere, vGroupBy)
LOOP
--FETCH cSelectCursor INTO cRec;
cTIAL.Kampkod := '';
cTIAL.Abnr := '';
cTIAL.Sign := '';
cTIAL.Alarmdate := '';
cTIAL.Kampkod := i.Kampkod;
cTIAL.Abnr := i.Abnr;
cTIAL.Sign := i.fordsalj;
cTIAL.Alarmdate := i.alarmdate;
nCount := nCount + 1;
IF vLopnr = -1 THEN
raise_application_error(-20002,
'Error Creating task for: '||cTIAL.Kampkod||' '||cTIAL.Abnr||' Sales Rep: '||cTIAL.Alarmdate);
END IF;
END LOOP;
DBMS_OUTPUT.PUT_LINE('I created '||nCount||' records.');
END createFollowUpTask_Exposure;
Thanks in advance for any help.Hi,
Welcome to the forum!
Try this (not tested) as an example:
PROCEDURE createFollowUpTask_Exposure(psUppgkedjetyp IN tis.tial.uppgkedjetyp%TYPE DEFAULT NULL,
psAlarmtyp IN tis.tial.alarmtyp%TYPE DEFAULT NULL,
psSubtyp IN tis.tial.subtyp%TYPE DEFAULT NULL,
pnDays IN NUMBER DEFAULT NULL,
psKampkod IN tis.tiin.kampkod%TYPE DEFAULT NULL,
psKatnr IN tis.tiin.katnr%TYPE DEFAULT NULL,
psUtgava IN tis.tiin.utgava%TYPE DEFAULT NULL,
psKatslag IN tis.tikg.katslag%TYPE DEFAULT NULL,
psProdsyst IN tis.tikg.prodsyst%TYPE DEFAULT NULL,
psUppgtyp IN tis.tiin.uppgtyp%TYPE DEFAULT NULL,
psProdkod IN tis.tiin.prodkod%TYPE DEFAULT NULL,
psStatus IN tis.tiin.status%TYPE DEFAULT NULL) AS
cTIAL tis.tial%ROWTYPE;
vLopnr tis.tial.lopnr%TYPE;
vSqlWhere VARCHAR2(4000);
vGroupBy VARCHAR2(1000) := ' tiin.kampkod, tiin.abnr, tiko.fordsalj';
cSelectCursor SYS_REFCURSOR;
vSqlSelect VARCHAR2(4000);
psDays VARCHAR2(50);
cRec T_TIAL_REC;
nCount NUMBER := 0;
FUNCTION fnc_cSqlSelect(SqlWhere IN VARCHAR2,
GroupBy IN VARCHAR2) RETURN VARCHAR2 IS
BEGIN
RETURN 'SELECT tiin.kampkod,
tiin.abnr,
tiko.fordsalj,
MAX(tici.regdat) ALARMDATE
FROM tis.tiin
JOIN tis.tiko ON tiin.kampkod = tiko.kampkod
AND tiin.abnr = tiko.abnr
JOIN core.tici ON tiin.kampkod = tici.kampkod
AND tiin.abnr = tici.abnr
AND tici.inplnr = tiin.inplnr
WHERE 1 = 1 ' || SqlWhere || ' GROUP BY ' || GroupBy;
END fnc_cSqlSelect;
BEGIN
-- If these parameters are null, raise error
IF psUppgkedjetyp IS NULL AND psSubtyp IS NULL THEN
raise_application_error(-20001,
'Either Event Chain or Starting Event must be assigned');
END IF;
-- Populate TIAL values
IF psUppgkedjetyp IS NOT NULL THEN
cTIAL.Uppgkedjetyp := psUppgkedjetyp;
END IF;
IF psAlarmtyp IS NOT NULL THEN
cTIAL.Alarmtyp := psAlarmtyp;
END IF;
cTIAL.Handklass := 'T';
cTIAL.Blobid := 0;
IF pnDays IS NOT NULL THEN
psDays := '+ ' || pnDays;
END IF;
IF psSubtyp IS NOT NULL THEN
cTIAL.Subtyp := psSubtyp;
END IF;
-- Create Where clause for cursor
vSqlWhere := '';
IF psKampkod IS NOT NULL THEN
vSqlWhere := vSqlWhere || ' AND tiin.kampkod = ''' || psKampkod || '''';
END IF;
IF psKatnr IS NOT NULL THEN
vSqlWhere := vSqlWhere || ' AND tiin.katnr = ''' || psKatnr || '''';
END IF;
IF psUtgava IS NOT NULL THEN
vSqlWhere := vSqlWhere || ' AND tiin.utgava = ''' || psUtgava || '''';
END IF;
IF psKatslag IS NOT NULL THEN
vSqlWhere := vSqlWhere || ' AND tikg.katslag = ''' || psKatslag || '''';
END IF;
IF psProdsyst IS NOT NULL THEN
vSqlWhere := vSqlWhere || ' AND tikg.prodsyst = ''' || psProdsyst || '''';
END IF;
IF psUppgtyp IS NOT NULL THEN
vSqlWhere := vSqlWhere || ' AND tiin.uppgtyp = ''' || psUppgtyp || '''';
END IF;
IF psProdkod IS NOT NULL THEN
vSqlWhere := vSqlWhere || ' AND tiin.prodkod = ''' || psProdkod || '''';
END IF;
IF psStatus IS NOT NULL THEN
vSqlWhere := vSqlWhere || ' AND tiin.status = ''' || psStatus || '''';
END IF;ç
-- Loop through all records meeting input parameters and set required TIAL values.
OPEN cSelectCursor FOR fnc_cSqlSelect(vSqlWhere,
vGroupBy);
LOOP
FETCH cSelectCursor
INTO v; -- You must define a variable 'v' to hold the data of cursor
EXIT WHEN cSelectCursor%NOTFOUND;
--FETCH cSelectCursor INTO cRec;
cTIAL.Kampkod := '';
cTIAL.Abnr := '';
cTIAL.Sign := '';
cTIAL.Alarmdate := '';
cTIAL.Kampkod := i.Kampkod;
cTIAL.Abnr := i.Abnr;
cTIAL.Sign := i.fordsalj;
cTIAL.Alarmdate := i.alarmdate;
nCount := nCount + 1;
IF vLopnr = -1 THEN
raise_application_error(-20002,
'Error Creating task for: ' || cTIAL.Kampkod || ' ' ||
cTIAL.Abnr || ' Sales Rep: ' || cTIAL.Alarmdate);
END IF;
END LOOP;
CLOSE cSelectCursor;
DBMS_OUTPUT.PUT_LINE('I created ' || nCount || ' records.');
END createFollowUpTask_Exposure;
/Regards, -
I had a requirment where I need to calculate the duration of the etl runs on daily basis
So I have calculated the duration using the below formula.
by grouping the run_wid and using the column in criteria and hiding it(in order to avoid the error 'column in GROUPBY clause not in the projection list.')..
the reason for grouping the run_wid is when the etl fails it is run multiple times and multiple entries on same run_wid are generated so I have captured them by
grouping them based on run_wid.
Everything works here fine.
But when I want to analyze on the whole year average etl runs using the above process.
So in order to achieve this by taking the year and duration and grouping by run_wid. I again get the error 'column in GROUPBY clause not in the projection list.').
I can't use the run_wid in the criteria because it not showing at year level. Please suggest a way/idea on achieving this.
Edited by: 949675 on May 30, 2013 10:17 PMHi Yadav,
Thanks for suggesting the idea it worked little bit by not making me to pull the run_wid in both
criteria and adding in GROUP by in advanced tab.
The problem what I am facing now is the value is not average values and its only showing the sum
of all the values
The formula for calculating Average is Avg(round(sum(TimestampDiff(SQL_TSI_SECOND,Audit."Start Time",Audit."End Time"))/60,2)/60 by run_wid)
The columns in my criteria are
Year|Average
Ex:
In year 2011 the ETL has run 50 times, I am seeing 50 etls total run time in Average.
Maybe you are looking for
-
An algo for creating numeric unque numbers
I am creating a client application which would be used to load some data in the Oracle database residing at a central server. This client application needs to generate unique id(that can be only long values) for populating the database. How should we
-
CRM-MAS 4.0 SR1 required software updates lead to system crash !?
(long post, sorry !) Hello I'd like to know how MAS 4.0 behave when the software required for its installation are updated : over the past few months my computer has acted more and more strangely, and in the end I couldn't even log into Windows. The
-
Error while saving Ad-hoc report in Portal
Hi Experts, I am getting flowing error while saving Ad-hoc report in Portal Transport system is active - could not save/change queries Please let me know how to resolve this issue. Thanks in Advance Regards, Ravi
-
Help: Cannot boot Windows with GRUB
here is the strangest thing i have ever met: I cannot boot my Windows system after I installed Archlinux, which took me a huge amout of time I think the menu.lst file has no problem, the windows lines as follow: # (2) Windows title Windows rootnoveri
-
Java doesn't work in proxy environment
I assume it's because of the "separate process" approach to running Java taken by Safari 5.1, but when my system is set to use a proxy, Java ceases to function in Java 5.1. If I then return to a non-proxy environment, Java works again. In the proxy e