Query - is this possible
I am trying to create a query with the following columns and rows - simplified version
Office Mat group sales total sales totalcompany
01 aaa 100 1100
01 bbb 50 1250
02 aaa 1000 1100
02 bbb 1200 1250
The total company value should be for the material group for all reps and needs to be sorted by office and material group. Is this query possible? Any help is appreciated.
You might be able to create it by using cell definition. But in that case, your report will not be dinamic, you'll need to define each column and row.
Another option may be to use virtual key figures.
Hope this helps.
Regards,
Diego
Similar Messages
-
Is this possible? range query
I have a db with keys/data as the following
Key data
AA data1
AB data2
AA data3
AB data4
AA data5
AB data6
what I expect is
if search by key =AA return data1,3,5,
if searcy by key = A, return all records
when I query using DB_SET_RANGE
query A, only get all records with key ==AA
seems this is correct output based on the API description, while this is not so-called range query.
is it possible to get what I expect above? use a new BTree comparsion function? if so, AA and AB is treated as the same key, and will not be able to differentiate AA and AB.
right?
there are several threads on this, did not the answer. thanks
The DB_SET_RANGE flag is identical to the DB_SET flag, except that in the case of the Btree access method, the key is returned as well as the data item and the returned key/data pair is the smallest key greater than or equal to the specified key (as determined by the Btree comparison function), permitting partial key matches and range searchesHi,
Let's consider your database:
key data
AA data1
data3
data5
AB data2
data4
data6
If you do a DBC->c_get() with DB_SET_RANGE and as search key "A" than the cursor will be positioned on the first key/data pair AA - data1. This is correct and complies with the documentation. If you than iterate with DB_NEXT on the DBC->c_get() call (as presented in the previous range_query function) you will sequentially retrieve each record within the database (the records are sorted lexically by key, and duplicates are sorted lexically on the data portion - by default). When you iterate with DB_NEXT_DUP on the DBC->c_get() call you will retrieve the records with the "AA" key.
If you do the DBC->c_get() with DB_SET_RANGE and a search key "AA" than the cursor will be positioned, as in the previous case, on the first key/data pair AA - data1. The same applies when iterating with DB_NEXT or DB_NEXT_DUP.
When you do a range search on "AA" and iterate with DB_NEXT you will get all the records because all the records have the key equal or greater (lexically) than "AA".
The same goes for a range search on "A" and iterating with DB_NEXT.
If you expect to get data1, data 2, data3 when searching on "AA" than this is not a range search, it is a simple query (done with DB_SET initially and than iterate with DB_NEXT_DUP).
If you use the function that I posted previously (exactly as it is) and you pass it "A" as searchKey then you will retrieve all the records, just as you expected.
Here is an excerpt from the documentation:
DB_SET
Move the cursor to the specified key/data pair of the database, and return the datum associated with the given key.
The DBcursor->c_get method will return DB_NOTFOUND if DB_SET is set and no matching keys are found. The DBcursor->c_get method will return DB_KEYEMPTY if DB_SET is set and the database is a Queue or Recno database, and the specified key exists, but was never explicitly created by the application or was later deleted. In the presence of duplicate key values, DBcursor->c_get will return the first data item for the given key.
DB_SET_RANGE
The DB_SET_RANGE flag is identical to the DB_SET flag, except that in the case of the Btree access method, the key is returned as well as the data item and the returned key/data pair is the smallest key greater than or equal to the specified key (as determined by the Btree comparison function), permitting partial key matches and range searches.I hope this clarifies the way to deal with a range query, if not then let me know and I will present a program that demystifies this.
Best regards,
Andrei -
select empno,name,sum(sal) from emptable where year=' ' groub by empno order by empno.
this query getting error because i didn't include empname in group by.
But if i include this name, my sum is not correct.
so i want to empno,name but i don't want to include name in group by. Is this possible?
My oracle verion is 8.
IS any other solution to solve this problem?
Thanks in advance.i want to empno,name but i don't want to include name in group by. Is this possible?<br>
<br>
No. It isn't.
<br>
select empno,name,sum(sal) over (partition by empno) <br>
from emptable
<br>where year=' '
<br>
-- <s>groub by empno</s>
<br>
order by empno; -
SAP Query- Is summation possible
Dear All,
Pls let me know if we can do summation in SAP Query to get a count on positions for example.
Eg. If i ve say 25 positions in the system pulled out by through Query, can i be able to sum them up saying the count is "25" in SAP Query.
Points would be awarded.
Thanks.will put up the example as below:
the query pulls out a report on the existing positons as below:
Object Type Start Date End Date Object Name
S 01.01.2005 31.12.9999 HR
S 01.01.2005 31.12.9999 Marketing
S 01.01.2005 31.12.9999 Finance
S 01.01.2005 31.12.9999 ABC
Now, I want the report to diplay the count of the position as "4" somewhere above.
Is this possible in to get this count in standard report or query? -
Suggest the query to this tricky query please
Hi people,
I just got a query which is a brain tease for me (not all).
that is
sql> select * from mytab;
sql> no name
1 asuri
1 prasanth
2 brian
2 lara
the above is query is returned by the sql;
here 1 and 2 are duplicated values;
now output required is
sql>no name
1 asuri prasanth
2 brain lara
Is this possible with a single sql query;
please tell me solution
regards
prasanthHow do find that it should be brian lara not lara brian..
But any way the following will do ...SQL> select * from mytab;
A NAME
1 asuri
1 prasanth
2 brian
2 lara
SQL> select a,name||' '||name2 name from
2 (
3 select a,name,lead(name) over (partition by a order by a) name2 from mytab)
4 where name2 is not null;
A NAME
1 asuri prasanth
2 brian lara
The names by above query can be returned as 'lara brian' and 'prasanth asuri' as there is no way telling which one is a surname.. -
Set variable value from a query - is it possible?
Hi all,
I need to use a 'precalculated' value in my report measures' calculations.
Is it possible to set a variable value as a result of a query?
Thanks in advance,
AlexHi,
In my report, I need to calculate one of the columns as a [certain measure] / [result of another query]
I didn't succeed to include the [result of another query] as a column in my report's request, but it would be very easy to calculate this [result of another query] separately.
The [result of another query] value is same for all the rows of my report.
What I'm trying to do is to run a query before my report (e.q. in the Prefix section), set a variable = [result of another query] and then use this variable in the column calculation of the report.
Is this possible?
Thanks,
Alex -
HELP! JSP as items in a region - is this possible?
Hi All,
Can someone please tell me how to bring in a JSP code as an item or portlet within a region. Is this possible with Oracle9iAS release 2? I need to generate dynamic html within a particular region based on a query string parameter and I thought this is one way of doing it.
If anyone can help, that would be great!
Thanks in advance,
KimKim,
There are many articles on Portal Center that discuss building portlets from JSPs. You can also post questions on this topic to the PDK forum.
For PL/SQL, there are a number of options. You can build PL/SQL portlets - the dynamic page component is a good start, that is conceptually similar to JSPs.
You can also create PL/SQL items that can be rendered in-place or displayed as a link - make sure that you don't use the "Simple PL/SQL" item type, as you can't control the rendering behaviour. Use the supplied "PL/SQL" item type, or create your own custom item type based on "Simple PL/SQL".
Finally, any item type (except the "simple" ones) can be associated with a procedure that can generate dynamic content. The procedures can be PL/SQL or any function that can be invoked via a URL (e.g. a JSP or servlet).
Note that in your PL/SQL procedures you'll need to use the HTP package to generate HTML.
Regards,
Jerry
Portal PM -
I Need to Return Two values or more from Function, Is this possible?
Below is the offending query, I am trying to pass v_bu and v_po to this function, and after validations then return v_count and v_action is this possible in a function? I am having problem returning two values.
see below code
function po_edi_func(v_bu purchase_order.business_unit_id%type,
v_po purchase_order.purchase_order_number%type)
return number as pragma autonomous_transaction;
v_count number;
v_ctdel number;
v_action varchar2(1);
begin
select count(*)
into v_count
from sewn.purchase_order
where business_unit_id=v_bu
and purchase_order_number =v_po;
if v_count > 0 then
select count(*)
into v_ctdel
from sewn.purchase_order
where business_unit_id=v_bu
and purchase_order_number =v_po
and purc_orde_status = 1;
if v_count <> v_ctdel then -- ALl PO's Cancelled--
v_action := 'U'; -- - NOT ALL PO DELETED --
else
v_action := 'D'; -- DELETED ALL PO--
end if;
else
v_action := 'I';-- New PO INSERT--
end if;
commit;
return v_count;
end;Paul,
This is becoming a nightmare to me, can you look at the below and tell me where I am having a problem
This is the Function below
CREATE OR REPLACE function po_edi_func(v_bu sewn.purchase_order.business_unit_id%type,
v_po sewn.purchase_order.purchase_order_number%type,v_action_out OUT VARCHAR2)
return number as pragma autonomous_transaction;
v_count number;
v_ctdel number;
v_action varchar2(1);
begin
select count(*)
into v_count
from sewn.purchase_order
where business_unit_id=v_bu
and purchase_order_number =v_po;
if v_count > 0 then
select count(*)
into v_ctdel
from sewn.purchase_order
where business_unit_id=v_bu
and purchase_order_number =v_po
and purc_orde_status = 1;
if v_count <> v_ctdel then -- ALl PO's Cancelled--
v_action := 'U'; -- - NOT ALL PO DELETED --
else
v_action := 'D'; -- DELETED ALL PO--
end if;
else
v_action := 'I';-- New PO INSERT--
end if;
commit;
v_action_out := (lpad(v_count,8,'0')||lpad(v_action,1,' '));
return v_action_out;
end;
and this is how I am calling it from my trigger which has to pass the v_bu and v_po values to be used in extracting data and returning the records
see below
if po_edi_func(v_bu,v_po) <> '' then;
v_count:= (substr(v_action,1,8));
v_action := substr(v_actione,9,1);
else
v_count:=0;
v_action := 'I';
end if;
I need the extracted values of v_count and v_action for my app to reset some values -
Creating dynamic datasources. Is this possible?
Can I create a 'subset datasource' from an existing datasource
and then pass this subset datasource to the <jbo:RowsetIterate>
Let's assume I have a datasource containing 100 records.
How is is possible to create a new datasource from the exiting datasource
which will contain 10 records and then this new data source will be passed
to <jbo:RowsetIterate>?
I'd like to write a JSP Tag which reads the datasource and creates a subset datasource
dynamically
public class SubsetDS extends TagSupport
public int doStartTag() throws JspException
ApplicationModule am = dataSource.getApplicationModule();
ViewObject vo = am.findViewObject("V0");
while(vo.hasNext()){
Row r = vo.next();
// Iterate based on a certain condition and put the new records
// in a dynamically created DataSource
Is this possible?I don't know about the custom JSP tag part, there is a <jbo:CreateViewObject> tag and ApplicationModule.createViewObject() methods for defining ViewObjects at runtime. We were not able to locate a mechanism for actually running a query against one VO to select rows for a second VO (whether defined at compile-time or runtime). We created a VO at runtime so we could base it's result set on another VO.
See "Ways to Add a View Object Instance to the Data Model at Runtime" topic in JDev help (we're using 10.1.2, but there's a <jbo:CreateViewObject> tag going back to at least 9.0.3.3); I located using JDev's Help's text search for createviewobject.
In our case, because the two queries were related (subset), we obtained the where clause from the VO that we defined at compile-time and whose where clause is being set at run time by values passed in from an HTML query form. We then applied that where clause to the dynamically created VO to get the desired subset.
Hope that gives you a starting place and helps. -
Query: Is it possible to change Infoset of a Query
Hello!
I have a question, I would like to know if the following it is possible:
I have Query A and Infoset B and C. At the moment Infoset B is assigned to Query A, would it be possible to assign Infoset C to Query A?
I was looking for this possibility, but could not find it anywhere, so if you have an idea, just tell me, thanks a lot!
DominikNot Possible
-
BI Query Monthly (this year and last year) vs YTD (this year and last year)
I have a query requirement in BI to create a Query which will give me
Sales Monthly (this year and last) vs YTD Sales (this year and last).
Here is an example of how the query would look:
01/2007 01/2008 02/2007 02/2008 03/2007 03/2008 YTD 2007 YTD 2008
Above would represent CKF's by month and YTD with Text Variables.
Is this possible? Obviously my problem is the number of columns that I would need, since I would not always be reporting on the same month(s). Any suggestions (if this is possible).
ThanksHi,
You can do it, see the following code and change as per your requirement...
FMYEAR and LMYEAR Customer Exit variables on 0CALMONTH. If you have any input variable then link it.
Note: Use Offsets for the following Variables to get 2007,2008,2009 results...
* First Month Of Current Fiscal year comment*
WHEN 'FMYEAR'.
CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
EXPORTING
i_date = sy-datum
* I_MONMIT = 00
i_periv = 'V3'
IMPORTING
e_buper = zbuper
e_gjahr = zbdatj.
CLEAR: l_s_range.
l_s_range-low+4(2) = '04'.
l_s_range-low+0(4) = zbdatj.
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
APPEND l_s_range TO e_t_range.
* Last Month of Current Fiscal year*
WHEN 'LMYEAR'.
CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
EXPORTING
i_date = sy-datum
* I_MONMIT = 00
i_periv = 'V3'
IMPORTING
e_buper = zbuper
e_gjahr = zbdatj.
CLEAR: l_s_range.
l_s_range-low+4(2) = '03'.
l_s_range-low+0(4) = zbdatj + 1.
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
APPEND l_s_range TO e_t_range.
Thanks
Reddy -
Invoke task from another process defnition - Is this possible
Is this possible to invoke task from another process defnition?
PD1 has task1
PD2 has task2
call PD1.task1 from PD2.task2
If possible, then what API method should I use.
Thank you!You would start by using the findObjects API to find all the objects for a specifc user. Then you would want to find the appropriate one from the result set. Then once you find this, you will need to either query the database or use apis to find the task key for the specific task name you want for that process definition. Once you have the process instance key and the task instance key for that user, you can then use the api to insert task into the users process instance.
Not sure all the APIs to use, but in the end you'll use addProcessTaskInstance found in the tcProvisioningOperationsIntf. You can search the forums for that API and examples of it's usage.
-Kevin -
I have two separate itune accounts under two different email accounts and would like to combine them under one account. Is this possible and if so, how do I do it?
If you go to Settings > iTunes & AppStore , you can sign out from your account, and sign in with the one you've used to purchase apps.This will not remove any apps you already have on it.
Then you can go to AppStore and download apps you've purchased (either via "Purchased" button in "Updates", or simply search for them and download them.
That way you can have multiple accounts' apps on your iPad. When updating, you will be prompted for the credentials for account you've purchased given App with. -
I work with a child who has physical disability and cannot move his neck. The ipad needs to be eyelevel in order for him to see it, but he also is not able to raise his hand and would need mouse access... is this possible?
I'm sorry but the iPad does not work with a mouse, there is no cursor on the iPad and the iPad was designed as a touch screen device so a mouse will not work.
I really don't know what to suggest other than this new device, and it might be worth a look. I assume that the child can use his hands for a keyboard.
http://www.thinkgeek.com/product/e722/ -
Unfortunately, I lost by an update all the apps on my iPad 2. Now I can not pull the data from the cloud to my iPad. How is this possible?
If you just installed iCloud does that mean you updated the iOS that's running on your iPad? If so, you'll want to restore all the programs you have from the backup you hopefully made.
Refer to these articles for help.
iTunes: Backing up, updating, and restoring iOS software.
If you don't want to use iCloud, simply don't activate it.
You can also download the programs again.
If you live in a country that supports re-downloading apps then you can re-download them. You can refer to this article for more help.
Downloading past purchases from the App Store and iTunes Store
What to know if your country supports downloading past purchases?
iTunes in the Cloud Availability
Maybe you are looking for
-
How can I know that the listener is starting up?
Hi, I follow the instruction in ACS Oracle Installation guide. I believe that many of you use the document to install oracle. I have a question when I try to start the listener. when I execute ./listener8i stop or ./listener8i start I got the same me
-
Slow Performance when program was once 100% proficient
I am working on a 2011 Macbook Pro - OS X version 10.9.5 For over a year I have been working in Adobe Premiere Elements 11 on this computer with no issues. Recently the program began running EXTREMELY slow - for example., taking well over an hour to
-
Zen Style M300 problem lock button
Hi, I have my new Zen Style M300 with a problem. The lock button is not working. If I move the button to the right position the device is not blocked, so if I touch any other button (an arrow...) it is possible to modify the music, radio or wathever.
-
How do I make images of text searchable on a Mac?
I am downloading a lot of PDFs from the New York Times archives (c. 1855) for some historical research I'm doing. I assume the Times has OCR'd their images of these old articles because the text is word-searchable online. Here are my questions, in de
-
Scaling factor problem in SAP Report Painter
Hello, I am designing reports using various scaling factors for column representation. The Scaling factor of 10 million is not working. It is observed that the scaling factor is working fine till 1 million i.e. 1,000,000. If the scaling factor is in