Query to group by based on partial count match
Dear experts,
Here is a challenge question.
I have a table a on Oracle 11i – this is how it is defined.
desc a
Name Null Type
STORE_NUMBER NOT NULL CHAR(9)
ASSORTMENT_NUMBER NOT NULL CHAR(9)
ITEM_NUMBER NOT NULL CHAR(9)
DESCRIPTION CHAR(1000)
UPC_CODE NOT NULL CHAR(15)
STOCK_FLAG CHAR(1)
AVG_RTL_PRICE CHAR(16)
SALES_MOVEMENT CHAR(16)
PROD_STYLE CHAR(50)
COLOR CHAR(50)
ATT_1 CHAR(50)
ATT_2 CHAR(50)
ATT_3 CHAR(50)
ATT_4 CHAR(50)
ATT_5 CHAR(50)
ATT_6 CHAR(50)
ATT_7 CHAR(50)
ATT_8 CHAR(50)
ATT_9 CHAR(50)
ATT_10 CHAR(50)
ATT_11 CHAR(50)
ATT_12 CHAR(50)
ATT_13 CHAR(50)
ATT_14 CHAR(50)
ATT_15 CHAR(50)
25 rows selected
Primary Key as Store_number, Assortment_number, item_number. Therefore, for a particular assortment number, one store will have no two records of the same item_number.
Now, I want to add some more custom conditions to my extract from this table; we are doing this manually on an xls file by applying some formula. Wondering if we can do this by a sql query.
Here are the conditions –
1. From table a, for any particular assortment_number, count of items belonging to a store. E.g –
Count of items Store_number
5 1011
7 1022
23 1033
12 1044
2. This is more challenging. From table a, for stores with the same count of item_numbers, list down the store numbers which have the same count of items and same items in the set under them. E.g – as below.
Count of items Store_number Item_number Match Indicator Matching Stores
5 3 123|12|1234|12|1 N
5 24 123|123|123|123|123 Y 22|234
5 21 123|451|2341|234|5100 N
5 22 123|123|123|123|123 Y 24|234
5 456 123|12|1|2|3 N
5 234 123|123|123|123|123 Y 22|24
3 45 12|123|12 Y 222|150
3 432 21|34|56 Y 123
3 222 12|123|12 Y 45|150
3 123 21|34|56 Y 432
3 150 12|123|12 Y 45|222
The above table may get positions shifted to its left due to formatting.
Appreciate your time and effort.
Thank You.
create table tmp_storeaggbyitem as
select
ltrim(trim(a.store_number),0) as store,
ltrim(trim(a.item_number),0) as item
from guide_pog_item_mstr a
where ltrim(trim(a.assortment_number),0) = '25571'
)Sample data in the table looks like this -
Store Item
49 59310
49 59315
49 59114
49 59295
63 59310
63 59315
63 59314
63 59308
138 59310
138 59315
138 59114
138 59295
174 8399
174 6132
174 6129
174 6137
174 6175
270 8399
270 6132
270 6129
270 6137
270 6175
343 8399
343 6132
343 6129
343 6137
343 6175Here is the result set I am looking for -
Store Count of Items Item Matching Stores
49 4 59310|59315|59114|59295 49|138
63 4 59310|59315|59314|59308 None
138 4 59310|59315|59114|59295 49|138
174 5 8399|6132|6129|6137|6175 174|270|343
270 5 8399|6132|6129|6137|6175 174|270|343
343 5 8399|6132|6129|6137|6175 174|270|343
.....Which version of the database are you using? The LISTAGG fucntuion (which is avaialble in Oracle 11.2, but not in 11.1) might be helpful here.
>
We are using Oracle Enterprise Edition 11.2.0.1.0 - 64 bit
Pl/Sql release 11.1.0.1.0
>
Why are you using the CHAR datatype instead of VARCHAR2? It may have nothing to do with this prolem, but it will cause other problems.
>
Agreed. I asked the same to my design team I inherited this table from. We are working out on the new table soon.
Thanks, Sanders.
Similar Messages
-
Query to group dates based on days of week
Hi,
I have a table containing the following format:
Create table testtable(dates date, day_identifier number);
The day_identifier column data contains the corresponding dates columns' day of week equivalent i.e.
to_char(dates, 'd')
The table contains following sample data:
Dates
Day_identifier
01-Oct-2013
3
02-Oct-2013
4
04-Oct-2013
6
06-Oct-2013
1
08-Oct-2013
3
09-Oct-2013
4
11-Oct-2013
6
18-Oct-2013
6
21-Oct-2013
2
23-Oct-2013
4
I am looking for a query that will group the above data based on the day_identifier column data into the following format:
01-Oct-2013 11-Oct-2013 1346
18-Oct-2013 23-Oct-2013 246
The above data if expanded i.e.
all dates between 01-Oct-2013 and 11-Oct-2013 and having day of week value in 1,3,4,6
and
all dates between 18-Oct-2013 and 23-Oct-2013 and having day of week value in 2,4,6
will give me the above table's resultset.
Please help me in resolving the issue.
Thanks.with
groups as
(select 'one' grp,
to_date('01-Oct-2013','dd-Mon-yyyy') low_date,
to_date('06-Oct-2013','dd-Mon-yyyy') high_date,
'3,5,7' day_identifiers from dual union all
select 'two',to_date('10-Oct-2013','dd-Mon-yyyy'),to_date('16-Oct-2013','dd-Mon-yyyy'),'1,2' from dual union all
select 'six',to_date('20-Oct-2013','dd-Mon-yyyy'),to_date('26-Oct-2013','dd-Mon-yyyy'),'4,5,6' from dual
dates as
(select trunc(sysdate,'mm') + level - 1 the_date,to_char(trunc(sysdate,'mm') - level - 1,'d') day_identifier
from dual
connect by level <= to_number(to_char(last_day(sysdate),'dd'))
select d.the_date,d.day_identifier,g.grp,g.low_date,g.high_date,g.day_identifiers
from dates d,
groups g
where d.the_date between g.low_date(+) and g.high_date(+)
and instr(','||g.day_identifiers(+)||',',','||d.day_identifier||',') > 0
THE_DATE
DAY_IDENTIFIER
GRP
LOW_DATE
HIGH_DATE
DAY_IDENTIFIERS
10/01/2013
1
10/02/2013
7
one
10/01/2013
10/06/2013
3,5,7
10/03/2013
6
10/04/2013
5
one
10/01/2013
10/06/2013
3,5,7
10/05/2013
4
10/06/2013
3
one
10/01/2013
10/06/2013
3,5,7
10/07/2013
2
10/08/2013
1
10/09/2013
7
10/10/2013
6
10/11/2013
5
10/12/2013
4
10/13/2013
3
10/14/2013
2
two
10/10/2013
10/16/2013
1,2
10/15/2013
1
two
10/10/2013
10/16/2013
1,2
10/16/2013
7
10/17/2013
6
10/18/2013
5
10/19/2013
4
10/20/2013
3
10/21/2013
2
10/22/2013
1
10/23/2013
7
10/24/2013
6
six
10/20/2013
10/26/2013
4,5,6
10/25/2013
5
six
10/20/2013
10/26/2013
4,5,6
10/26/2013
4
six
10/20/2013
10/26/2013
4,5,6
10/27/2013
3
10/28/2013
2
10/29/2013
1
10/30/2013
7
10/31/2013
6
Regards
Etbin -
Query to Group records based on
Hello,
I need a help.
I have a errortable with 4 columns (pk, errordate, activestatus, errormsg). I need to get a count of the records with a pattern of errormsg but im getting lost on this, not sure where is the problem.
For example there are records with errormsg column which has logged some error msgs like say
'xxxIn-Housexxx'
'yyyCheckedInyyy',
aaaIn-Hoouseaaa',
bbbCheckedInbbb'
I'm only interested to have a count of all those with the pattern match of 'In-House' and 'CheckedIn'
this is the one i was trying, which is giving me some syntax error not sure what it is
select count(*) from error_table where errordate > sysdate - 3
group by errormsg
having
errormsg like '%In-House%'
or
errormsg like '%CheckedIn%'
I'm really confused to get a working sql for this. can you please help me.
thanksselect sum(case
when upper(errormsg) like '%IN-HOUSE%' then 1
else 0
end
) in_house_error
,sum(case
when upper(errormsg) like '%CHECKEDIN%' then 1
else 0
end
) checkedin_error
from error_table
where errordate > sysdate - 3
; -
EJB Query Language where condtion based on date
Hi,
I am using EJB3 query language. In the table I have a column called requestdate which is in date time format. I have created an entity class.
I need to select few records using query language(named queries) based on this requestdate matching to the current date. I want to compare only based on Date value (truncating the time). Something like this
select max(o.req_id) from requests o where o.requestdate = :currentdate
currentdate is java.sql.Date value formatted to yyyymmdd only.
How can I do this using query language?
Please help to me get this done.
thanka
AnuradhaHi Anuradha ,
I'm afraid the query language does not support retrieving the date portion (i.e. truncating the time) from a date field.
I propose you turn you named into a BETWEEN query taking two parameters one for the beginning of the day and another for the end of the day. Then your named query could look like:
SELECT max(o.req_id) FROM requests o WHERE o.requestdate BETWEEN :start AND :end
The following code creates two calendar instances for the current day, one for 00:00:00 and another for 23:59:59:
Calendar start = Calendar.getInstance();
start.set(Calendar.HOUR_OF_DAY, 0);
start.set(Calendar.MINUTE, 0);
start.set(Calendar.SECOND, 0);
start.set(Calendar.MILLISECOND, 0);
Calendar end = Calendar.getInstance();
end.set(Calendar.HOUR_OF_DAY, 23);
end.set(Calendar.MINUTE, 59);
end.set(Calendar.SECOND, 59);
end.set(Calendar.MILLISECOND, 999);
Here is some sample code that creates a query instance for a named query called findMaxRequestPerDay and passes the Date of the above Calendar instance as actual parameter values. It assumes the named query is called findMaxRequestPerDay and the req_id field is a long:
Query query = em.createNamedQuery("findMaxRequestPerDay");
query.setParameter("start", start.getTime());
query.setParameter("end", end.getTime());
Long max = (Long)query.getSingleResult();
I hope this helps.
Regards Michael -
Query not considering function based index in oracle 11g
I have a query which used Function Based Index when run in oracle 9i but when I run the same query
without any changes, it does not consider index. Below is the query:
SELECT distinct patient_role.domain_key, patient_role.patient_role_key,
patient_role.emergency_contact_name,
patient_role.emergency_contact_phone, patient_role.emergency_contact_note,
patient_role.emergency_contact_relation_id,
patient_role.financial_class_desc_id, no_known_allergies, patient_role.CREATED_BY,
patient_role.CREATED_TIMESTAMP,
patient_role.CREATED_TIMESTAMP_TZ, patient_role.UPDATED_BY, patient_role.UPDATED_TIMESTAMP,
patient_role.UPDATED_TIMESTAMP_TZ,
patient_role.discontinued_date
FROM encounter, patient_role
WHERE patient_role.patient_role_key = encounter.patient_role_key
AND UPPER(TRIM(leading :SYS_B_0 from encounter.account_number)) = UPPER(TRIM(leading :SYS_B_1 from
:SYS_B_2))
AND patient_role.discontinued_date IS null
AND encounter.discontinued_date IS null ;
Index definition:
CREATE INDEX "user1"."IX_TRIM_ACCOUNT_NUMBER" ON "user1."ENCOUNTER" (UPPER(TRIM(LEADING
'0' FROM "ACCOUNT_NUMBER")), "PATIENT_ROLE_KEY", "DOMAIN_KEY", "DISCONTINUED_DATE")
PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
BUFFER_POOL DEFAULT)
TABLESPACE "user1"
Database : Oracle 11g (11.2.0.3)
O/S : Linux 64 bit (the query does not consider index even on windows os)
Any suggestions?
-Onkar
Edited by: onkar.nath on Jul 2, 2012 3:32 PMOnkar,
I don't appreciate you posting this question in several forums at the same time.
If I would know you also posted this on Asktom, I wouldn't even have bothered.
As to your 'issue':
First of all: somehow cursor_sharing MUST have been set to FORCE. Oracle is a predictable system, not a fruitmachine.
Your statement the '0' is replaced by a bind variable anyway is simply false. If you really believe it is not false, SUBMIT a SR.
But your real issue is not Oracle: it is your 'application', which is a mess anyway. Allowing for alphanumeric numbers is a really bad idea.
Right now you are already putting workaround on workaround on workaround on workaround.
Issue is the application: it is terminal., and you either need to kill it, or to replace it.
Sybrand Bakker
Senior Oracle DBA -
SQL query using Group by and Aggregate function
Hi All,
I need your help in writing an SQL query to achieve the following.
Scenario:
I have table with 3 Columns. There are 3 possible values for col3 - Success, Failure & Error.
Now I need a query which can give me the summary counts for distinct values of col3 for each GROUP BY of col1 and col2 values. When there are no values for col3 then it should return ZERO count.
Example Data:
Col1 Col2 Col3
abc 01 success
abc 02 success
abc 01 success
abc 01 Failure
abc 01 Error
abc 02 Failure
abc 03 Error
xyz 07 Failure
Required Output:
c1 c2 s_cnt F_cnt E_cnt (Heading)
abc 01 2 1 1
abc 02 1 1 0
abc 03 0 0 1
xyz 07 0 1 0
s_cnt = Success count; F_cnt = Failure count; E_cnt = Error count
Please note that the output should have 5 columns with col1, col2, group by (col1,col2)count(success), group by (col1,col2)count(failure), group by (col1,col2)count(error)
and where ever there are NO ROWS then it should return ZERO.
Thanks in advance.
Regards,
ShivaHi,
user13015050 wrote:
Thanks TTT. Unfortunately I cannot use this solution because I have huge data for this.T's solution is basically the same as mine. The first 23 lines just simulates your table. Since you actually have a table, you would start with T's line 24:
SELECT col1 c1, col2 c2, SUM(decode(col3, 'success', 1, 0)) s_cnt, ...
user13015050 wrote:Thanks a lot Frank. It helped me out. I just did some changes to this as below and have no issues.
SELECT col1
, col2
, COUNT ( CASE
WHEN col3 = 'SUCCESS'
THEN 1
END
) AS s_cnt
, COUNT ( CASE
WHEN col3 = 'FAILED'
THEN 1
END
) AS f_cnt
, COUNT ( CASE
WHEN col3 = 'ERROR'
THEN 1
END
) AS e_cnt
FROM t1
WHERE c2 in ('PURCHASE','REFUND')
and c4 between to_date('20091031000000','YYYYMMDDHH24MISS') AND to_date('20100131235959','YYYYMMDDHH24MISS')
GROUP BY c1, c2
ORDER BY c1, c2;
Please let me know if you see any issues in this query.It's very hard to read.
This site normally compresses spaces. Whenever you post formatted text (such as queries or results) on this site, type these 6 characters:
\(small letters only, inside curly brackets) before and after each section of formatted text, to preserve spacing.
Also, post exactly what you're using. The code above is SELECTing col1 and col2, but there's no mention of either in the GROUP BY clause, so I don't believe it's really what you're using.
Other than that, I don't see anything wrong or suspicious in the query. -
Crosstab Query re Grouping Data into Value Ranges
Hi
I am trying to analyse some data in a Crosstab & have a query re grouping.
The data contains sales transaction info such as selling price, quantity etc. I would like to create a grouping in the Crosstab based on a sale price range (eg £0 - £10, £10 - £20 etc) so that I can show the total quantity sold in each price range.
To date my method has been to create a formula with Select Case which identifies each transaction into a price range. I would then use this formula in my Crosstab. The main issue with this method is that there will be a large number of Cases & the possibility this will need to be added to / modified going forward.
Whilst I think this will work I am hoping there is better method to follow?
Thanks
JonHi Jamie,
Thank you for your help.
I'm looking to group in increments of 10 so it looks like the Floor function will do the trick, thank you.
I'll probably use an If statement to do a "block" of prices at either end of the scale (ie < 100 then 100, > 1000 then 1000+ else Floor ({Sales Field},10). Hopefully this way I'll reduce the overall no of rows.
Thanks again for your help.
Jon -
Hi,
I have employee fact table, for example;
employee_id ||date || salary
101 ||23.01.2010 || 150
101 ||23.02.2010 || 130
101 ||23.03.2010 || 170
102 ||23.01.2010 || 100
102 ||23.02.2010 || 80
103 ||23.01.2010 || 50
103 ||23.02.2010 || 90
I create employee_id based measure as employee_salary
employee_salary
450
180
140
Then i want to group data;
Like this
employee_salary_group || count
total_salary>200 ||1
total_salary<=200 ||2
But result are;
employee_salary_group || count
total_salary>200 ||1
total_salary<=200 ||1
total_salary<=200 ||1
How i remove duplicate values on employee_salary_group measure?
Please help me to fix this problem,
HaydarHere you go...
Drag a column in answers and name it "employee_salary_group" and in the fx write
Case when sum(salary by employee_id ) >200 then "total_salary>200 " else "total_salary<=200" end
Drag another column and name it "Count" and in the fx write
sum(salary by employee_id )
Now you ll get the desired results..
Hope it helps....
Thanks
Ashish Gupta -
Querying user groups while using @RunAs on a bean
Hi,
I am trying to implement a scenario in which I have three entities:
- bean A - datastore for all users
- bean B - implementing logic, filtering results from datastore for specific user based on groups he is in
- User - calling bean B
Calling chaing is User -> bean B -> bean A.
bean B has to query user groups and filter data based on that. I've implemented that using:
Subject subject = Security.getCurrentSubject();
for (Principal principal : subject.getPrincipals()) {
if (principal instanceof WLSGroup) {
Without any security specified (like @RolesAllowed) it works like charm.
But I want to add security constraints to the beans:
@RolesAllowed("admin")
class A {}
@RolesAllowed("user")
class B {}
The problem is that B cannot acces A methods because it is calling A using 'user' security context.
I've thought I change it to:
@RunAs("application")
@RolesAllowed("user")
class B {}
"Application" is an account in group admin.
Now B can call A. The problem is that security context is switched to "application" on entering B's methods. Inside them I cannot query user groups using method presented above, because I get "application" groups.
Is there a way to change security context on calling other bean methods? Like using Security.runAs( somehowGetApplicationSubject(), runnable) ??
Other method I've thought of, but I have no idea how to implement that, is somehow querying weblogic to get groups of SessionContext.getCallerPrincipal(), which returns user account regardless of using RunAs.
Hope someone made through this problem before,
KrzysiekgetBounds() will only generally make sense while the component itself is being rendered. I wouldn't be completely surprised if the framework which gets that component also resets its size once it's done painting the thing.
If you're calling it from outside the rendering loop, perhaps you could try calling validate() on the component, which should force it to determine its size.
Failing that, you could possible use getPreferredSize() instead, which will likely obtain a similar result in most cases. -
Hi,
I have some data and need to group it based on date. please see the below data
pkey--------from_date----------to_date------------amount-------------
1 ---------8-aug-12 ----------31-aug-12---------120
1 ---------31-aug-12 --------1-sep-12--------- 130
1 ---------1-sep-12 ----------2-sep-12--------- 150
1 ---------3-sep-12 ----------4-sep-12--------- 150
1 ---------5-sep-12 ----------7-sep-12--------- 100
1 ---------7-sep-12 ----------8-sep-12--------- 200
1 ---------8-sep-12 ----------20-sep-12---------120
1 ---------20-sep-12 --------1-oct-12--------- 130
1 ---------1-oct-12 ----------8-oct-12--------- 150
and so on.....
I need to group the data when a month finished.. e.g row 1 from_date is 08-aug-12 row 6 to_date is 08-sep-12 means almost 1 month finished so it should group and show the sum of amount with min(from_date) and max(to_Date) and total amount monhtly basis.
I am trying to make a query since many hours but no success.. the data is huge with many keys and dates ... please share your idea/tips/feedback.
Thanks
Edited by: hard_stone on Jan 18, 2013 11:38 AMTry this
with t
as
select 1 pkey, to_date('08-aug-12', 'dd-mon-rr') from_date, to_date('31-aug-12', 'dd-mon-rr') to_date, 120 amount from dual
union all
select 2 pkey, to_date('31-aug-12', 'dd-mon-rr') from_date, to_date('01-sep-12', 'dd-mon-rr') to_date, 130 amount from dual
union all
select 3 pkey, to_date('01-sep-12', 'dd-mon-rr') from_date, to_date('02-sep-12', 'dd-mon-rr') to_date, 150 amount from dual
union all
select 4 pkey, to_date('03-sep-12', 'dd-mon-rr') from_date, to_date('04-sep-12', 'dd-mon-rr') to_date, 150 amount from dual
union all
select 5 pkey, to_date('05-sep-12', 'dd-mon-rr') from_date, to_date('07-sep-12', 'dd-mon-rr') to_date, 100 amount from dual
union all
select 6 pkey, to_date('07-sep-12', 'dd-mon-rr') from_date, to_date('08-sep-12', 'dd-mon-rr') to_date, 200 amount from dual
union all
select 7 pkey, to_date('08-sep-12', 'dd-mon-rr') from_date, to_date('20-sep-12', 'dd-mon-rr') to_date, 120 amount from dual
union all
select 8 pkey, to_date('20-sep-12', 'dd-mon-rr') from_date, to_date('01-oct-12', 'dd-mon-rr') to_date, 130 amount from dual
union all
select 9 pkey, to_date('01-oct-12', 'dd-mon-rr') from_date, to_date('08-oct-12', 'dd-mon-rr') to_date, 150 amount from dual
select min(from_date) from_date, max(to_date) to_date, sum(amount) amount
from (
select pkey, from_date, to_date, amount, next_month
from t
model
dimension by (pkey)
measures (from_date, to_date, amount, to_date('19000101', 'yyyymmdd') next_month, add_months(from_date, 1) temp_month)
rules upsert
next_month[any] = case when next_month[cv(pkey)-1] >= to_date[cv(pkey)] then next_month[cv(pkey)-1]
else temp_month[cv(pkey)] end
group by next_month;
FROM_DATE TO_DATE AMOUNT
08-AUG-12 08-SEP-12 850
08-SEP-12 08-OCT-12 400 -
How I check in group by query the group change
How I check in group by query the group change
Hi master
Sir I have master detail table
This is my query
select rownum,chartofacc.accid,title,nvl(drbal,0),nvl(crbal,0),
(select case when nvl(sum(debit),0)-nvl(sum(credit),0)>0 then
nvl(sum(debit),0)-nvl(sum(credit),0)
else
0
end mfadrttt
from voudetail where voudetail.accid=chartofacc.accid) as mfadr,
(select case when nvl(sum(credit),0)-nvl(sum(debit),0)>0 then
nvl(sum(credit),0)-nvl(sum(debit),0)
else
0
end mfacrttt
from voudetail where voudetail.accid=chartofacc.accid) as mfacr
,nvl(debit,0),nvl(credit,0),voumaster.entdate,voumaster.vno from chartofacc ,accbal,voudetail,voumaster where chartofacc.accid=accbal.accid(+) and chartofacc.accid=voudetail.accid(+) and voumaster.vno=voudetail.vno order by chartofacc.accid,voumaster.entdate,voudetail.VNO;
Sir I need add opbal from master section to debit in detail section when new group start only after adding I use that column for accumulative total or running balance
If I get any method when group change system give me any key or indication then I use
Please give me idea in both field oracle sql and oracle report 6i
Thank
aamirHi,
Please send tables structures and sample data from that tables. And, of course what should be the output. :) Just sending your query won't help us to find a solution.
Peter D. -
Dynamic query table for report based on LOV selected
Hi,
Need some suggestion and guidance how to dynamically query table via lov for report .
Scenario:
Table, TABLE_LIST, has tablename (table in DB) and filter (for where clause) column. The TABLENAME_LOVE is derived from table TABLE_LIST.
SELECT TABLENAME D, TABLENAME R FROM TABLE_LIST
In Page 2,a page select list item,P2_TABLENAME to use TABLENAME_LOV
All data in tables in the table_list have identical structure (columns, triggers, primary key, and so on).
I want to have the report region query from the table based on selected LOV.
Example,
Tablename Filter
TB1
CD2 ACTIVE='Y'
When select TB1, the report regin will query based on TB1.
When select CD2, the report regin will query based on CD2 WHERE ACTIVE='Y'
Question:
How can I query based on &P2_TABLENAME. WHERE &P2_FILTER.
Like
select col1, col2 from &P2_TABLENAME WHERE &P2FILTER
Greatly appreciate any suggestion and some guidance.
TigerwapaHi,
You should always post your Apex version, DB version and other information as suggested in the FAQ.
And the moment you talk report you should state whether it is IR or Classic.
As for your query, have you explored the Report type "SQL Query (PL/SQL function body returning SQL query)" ?
That might be a good fit for what you are trying to achieve.
Regards, -
Query Designer - Query:Specialist Group Status
Hi Gurus,
One of my BI user is getting error in this:
In Query Designer - Query:Specialist Group Status
"Registered JIT debugger is not avialable. An attempt to launch a JIT debugger with the following
command resulted in an error code of 0x2(2). please check computer settings.
cordbg.exe !a 0x289c"
but when I tried with SUPER USER access i am not getting above error.
Guys please suggest me asap
Thanks
sahadhello,
Check the variabledefinitions of the query.
Try RSRT and 'execute and debug'.
It might be you get a lot more detailed information about the problem.
see OSS note 961995.
Regards,
Dhanya -
Assign SQ03 Abap Query User Group to role
Please advise how to assign SQ03 Abap Query User Group to a role. Thanks.
Moderator message: please do more research before asking.
[Rules of engagement|http://wiki.sdn.sap.com/wiki/display/HOME/RulesofEngagement]
[Asking Good Questions in the Forums to get Good Answers|/people/rob.burbank/blog/2010/05/12/asking-good-questions-in-the-forums-to-get-good-answers]
Edited by: Thomas Zloch on May 12, 2011 5:40 PMHello Sunil,
The problem is that I have hundreds of users to maintain user groups.
found out that it is possible to assign user group to role and role to user groups. implementing hr authorization with in-direct assignment of auth. So if I could use sq10, user groups could also be link to position in the org chart.
sq10 does allow you to assign a user group to a role but when you assign the role to a user and the user runs a query, it reports that no user group has been assigned.
Suspect that there must be a parameter or switch that is not turned on
Regards -
Problem when querying OLAP for Value based hierarchy
Hi I have problem when querying OLAP for value based hierarchy , for level based dimension it work fine
the strange part is if I only put one value, it will work perfectly
for example if I put only 1 value for that value base hierarchy like CF_HIER::426362, then it will get the correct value for that id 426362
but if I put multiple value to the list
CF_HIER::426362
CF_HIER::424470
CF_HIER::429073
CF_HIER::424230
then only some value will come out correctly, some of them will be 0, I wonder why because if I query using each value, then it show correct value
for multiple value usually only the top in hirarchy give correct value, but the leaf will give 0, but if I query only the leaf, the leaf will give correct value
this problem only happen for my value based hierarchy, for the level based hierarchy it work fine both for each value or multiple value in the list
this is the code how I guery
////the "elementIdList" is where the value is (CF_HIER::426362,CF_HIER::424470,CF_HIER::429073,CF_HIER::424230), if I only put single value in this list the query work fine, but if I put multiple value then some value give correct result, some will give 0
String[] elementIdArr = new String[elementIdList.size()];
int i = 0;
for (Long elementId: elementIdList) {
String elementIdStr ="";
if (hierarchy instanceof MdmLevelHierarchy)
elementIdStr = hierarchy.getName()+dimension.getValueSeparationString()+
level.getName()+dimension.getValueSeparationString()+
level.getName()+"_"+elementId;
else
elementIdStr = hierarchy.getName()+dimension.getValueSeparationString()+
elementId;
elementIdArr[i++] = elementIdStr;
Source myList = dp.createListSource(elementIdArr);
result = hierarchy.getSource().selectValues(myList);
Source joinedSource = measure.getSource();
joinedSource = joinedSource.join(result );
is there any suggestion where I'm doing wrong?or is it different between querying value based hier with level based hier?
thanksHi I have problem when querying OLAP for value based hierarchy , for level based dimension it work fine
the strange part is if I only put one value, it will work perfectly
for example if I put only 1 value for that value base hierarchy like CF_HIER::426362, then it will get the correct value for that id 426362
but if I put multiple value to the list
CF_HIER::426362
CF_HIER::424470
CF_HIER::429073
CF_HIER::424230
then only some value will come out correctly, some of them will be 0, I wonder why because if I query using each value, then it show correct value
for multiple value usually only the top in hirarchy give correct value, but the leaf will give 0, but if I query only the leaf, the leaf will give correct value
this problem only happen for my value based hierarchy, for the level based hierarchy it work fine both for each value or multiple value in the list
this is the code how I guery
////the "elementIdList" is where the value is (CF_HIER::426362,CF_HIER::424470,CF_HIER::429073,CF_HIER::424230), if I only put single value in this list the query work fine, but if I put multiple value then some value give correct result, some will give 0
String[] elementIdArr = new String[elementIdList.size()];
int i = 0;
for (Long elementId: elementIdList) {
String elementIdStr ="";
if (hierarchy instanceof MdmLevelHierarchy)
elementIdStr = hierarchy.getName()+dimension.getValueSeparationString()+
level.getName()+dimension.getValueSeparationString()+
level.getName()+"_"+elementId;
else
elementIdStr = hierarchy.getName()+dimension.getValueSeparationString()+
elementId;
elementIdArr[i++] = elementIdStr;
Source myList = dp.createListSource(elementIdArr);
result = hierarchy.getSource().selectValues(myList);
Source joinedSource = measure.getSource();
joinedSource = joinedSource.join(result );
is there any suggestion where I'm doing wrong?or is it different between querying value based hier with level based hier?
thanks
Maybe you are looking for
-
Can anyone name the app used in this video?
What app is being used here? http://www.youtube.com/watch?v=7ONsYf6GfMQ
-
Hi Experts!!! I would like to know if there's a way of downloading or exporting / uploading or importing a query made in SQ01. I need to replicate it in another system. Thanks in advance!
-
Exception caught when special character sent to lookup
Hi Experts, When I sent a special character in the name field via "Address-Look-up (Java-Look-up)" an exception caught - (The exception is not visible - so used a value which get populated to all the target field where the loop-up is used). Receiver
-
2 (Probably Simple) Accordion Widget Questions
Hello! I am a video guy who tries to dive into this web design stuff once in a long while. Usually i can figure most stuff out by reading forums and stuff but this stuff if probably to obvious for anyone but myself to post about... 1)When I click on
-
How can you retrieve what OS your running in Java
I am trying to write some logic based on the OS I am on. Is there a way Java enables you to find our what OS you are running. Some kind of method? Thanks