Help with Query Builder
Hi,
I am trying to get a daily statistics of failed instances using Query Builder. I tried to use fields like SI_UPDATE_TS and SI_STARTTIME to filter instances with in a date range, but date range functions does not seem to work. Is there documentation somewhere as to which fields can be used or how the query should be formatted to get results like this?
Thanks
Ajith
Hello Ajith,
The Query Builder interface is actually rather limited, as you have found out yourself. I don't know if you have any programming experience, but the Query Builder is nothing more than an interface which will use the SDK in the background to talk to the CMS. In other words, if you know how to program for your BO XI deployment (Java or .NET), you can write the logic necessary to retrieve whatever information you want. You'll also find that the SDK documentation contains an explanation (though sometimes limited) for the properties and members that are available.
Although using the SDK might seem overwhelming at first, it's actually quite easy and far more powerful than the Query Builder alternative. Also, Business Objects hosts quite a few code samples that should easily get you started. There's also a dedicated SDK forum for all specific issues relating to development.
Some links to get you up and running:
[Developer Library|https://boc.sdn.sap.com/developer/library]
[Code Samples|https://www.sdn.sap.com/irj/sdn/businessobjects-samples]
[Business Objects SDK Application Development Forums|https://www.sdn.sap.com/irj/sdn/businessobjects-sdk-forum]
Hope this helps!
Kind regards,
Kristof
Similar Messages
-
Help with Query Builder please
Hi,
I would like to query the system database for reports using ftp, email, and unmanaged disk as Destinations. I am not familar with the datafields in the BOXI database nor with the Query Builder syntax or SQL type queries. Can someone provide samples of this type of query and possibly the exact field names to be included.
I would actually like to design a Crystal report that would return this information as needed. Something like...
Report name Report location Type of Destination Actual Destination specified
Any and all assistance would be greatly appreciated.Unfortunately these properties are nested within the results you will receive if you query for any of your individual reports within Query Builder. Try this out for reference:
select top 1 * from ci_infoobjects
where si_name = 'YOURREPORTNAME'
and si_instance = 1
Nested properites cannot be included in the select clause of your query. For the majority of nested properties such as instance destinations, you'll need to either develop script to retrieve this information or utilize a 3rd party product (System Profiler, etc) that has this information available and pre-build reports. -
QueryString issues with Query Builder and Search Box
Hi Guys,
I've got the following scenario (Issues are bolded for quicker reading):
I have a search results pages named results.aspx
I have a page, named messages.aspx, with a webpart that display messages from a specific folder (which can be changed in the webpart properties). On that page, there's a search box which will lead to results.aspx, and will do search only on the specific
folder.
On the other hand, when I'm using Content Search Web Part, I can use the query builder to do the following:
ParentLink:{QueryString.folder}
So all I have left to do is to send the folder as a query string parameter from messages.aspx to results.aspx.
(1) The search box doesn't support sending other QueryString parameters,
which is also known to happen in previous SP versions, so I fixed the onclick events and voila, the folder parameter is transferred to results.aspx.
But something weird happens in results.aspx:
When I'm first redirected from messagses.aspx to results.aspx I get the follwing URL:
/Pages/results.aspx?k=Washington&folder=Home - I've got results
When another query is issued from the search box of results.aspx I'm getting the folliwing URL:
/Pages/results.aspx?k=Washington&folder=Home#k=Indiana - I've got NO results.
Same with paging:
/Pages/results.aspx?k=Washington&folder=Home#s=11
(2) When a QueryString parameter is present in the results.aspx page, and than another query (different keywords, paging or anything) is issued using AJAX and hashtags - no results are returned.
My guess is a client side issue: When the a new query is issued, adding a hashtag (#) to the URL, it ignores the QueryString parameter currently present in the URL, and thus the server doesn't recieve it in the query packet/http post xml, which creates a
valid query with no results, in my case: ParentLink:"", which I manually checked and does yield no results.
I've also tried the following with no help:
/Pages/results.aspx#k=Washington#folder=Home - no results. my guess is that folder is now not a QueryString
/Pages/results.aspx?folder=Home#k=Washington - No results.
/Pages/results.aspx#k=Washington&folder=Home - The query text issued was "Washington&folder=Home" - no results of course.
Any ideas any one?
AmirHi Amir,
after some months I found a workaround that solves this issue: just add & after your query string value, it will separate your parameter value from other strings that may be added by sharepoint controls.
ie:
if your page is http://spsite/page.aspx?param=value
just call it like this http://spsite/page.aspx?param=value&
It works!
Ciao
Fabio -
Need help with expression builder issue
Hi all
I'm hoping someone can help with an issue I'm having. I'm creating a database for a manufacturing joinery. For 1 of my forms, Ive to create a despatch form which includes order details along with customer details. Some customers can have contracts in which
they get a fixed price on certain item. This is where the problem lies.
For my customers table, I have a field called "On contract" which is a Yes/No field. I've created a query to attempt to make this form. I'm having trouble with adding a total column at the end of this query. Quantity,Unit Price, Contract Price
are also in the query. I've been trying to build an expression to say like;
iif [on contract] = "Yes", [Quantity] * [Contract Price]
iif [on contract] = "no", [Quantity] * [Unit Price]
It obviously wont work, what am I doing wrong?
Thanks in advanceHi,
Assuming you are using the database is SQL Server:
SELECT [CustomerID]
,[Quantity]
,[Unit Price]
,[Contract Price]
,[Total] = CASE WHEN [On Contract] = 'Yes' THEN [Quantity] * [Contract Price]
WHEN [On Contract] = 'No' THEN [Quantity] * [Unit Price] END
FROM [Customers]
Modify the SQL to suit your need.
Hope this helps.
~J. -
Help with query calculations (recursive)
Hi All,
I want some help with a query using a base rate and the result use in the next calculation year.
Here an example:
create table rate_type(
rate_type_id number,
rate_desc nvarchar2(50),
rate_base_year number
insert into rate_type(rate_type_id, rate_desc, rate_base_year) values (1, 'Desc1', 4.6590);
insert into rate_type(rate_type_id, rate_desc, rate_base_year) values (2, 'Desc2', 4.6590);
create table rates (
rate_type_id number
rate_year number,
rate_value number
insert into rates(rate_type_id, rate_year, rate_value) values (1, 2012, 1.2);
insert into rates(rate_type_id, rate_year, rate_value) values (1, 2013, 1.3);
insert into rates(rate_type_id, rate_year, rate_value) values (1, 2014, 1.4);
insert into rates(rate_type_id, rate_year, rate_value) values (2, 2012, 1.2);
insert into rates(rate_type_id, rate_year, rate_value) values (2, 2013, 1.3);
insert into rates(rate_type_id, rate_year, rate_value) values (2, 2014, 1.4);The calculation for the first year should be the base rate of the rate type. The next year should use the result of the previous year and so on.
The result of my sample data is:
2012 = 4.659 + 1.2 + 4.659 * (1.2 * 0.01) = 5.9149
2013 = 5.9149 + 1.3 + 5.9149 * (1.3 * 0.01) = 7.1859
2014 = 7.1859 + 1.4 + 7.1859 * (1.4 * 0.01) = 8.4721Query result:
NAME 2012 2013 2014
Desc1 5.9149 7.1859 8.4721
Desc2 XXXX XXX XXXX
How can I do this in one select statement? Any ideas?
Thanks!Assuming you are on 11.2:
with t as (
select a.rate_type_id,
rate_desc,
rate_year,
rate_base_year,
rate_value,
count(*) over(partition by a.rate_type_id) cnt,
row_number() over(partition by a.rate_type_id order by rate_year) rn
from rate_type a,
rates b
where a.rate_type_id = b.rate_type_id
r(
rate_type_id,
rate_desc,
rate_year,
rate_base_year,
rate_value,
cnt,
rn,
result
) as (
select rate_type_id,
rate_desc,
rate_year,
rate_base_year,
rate_value,
cnt,
rn,
rate_base_year + rate_value + rate_base_year * rate_value * 0.01 result
from t
where rn = 1
union all
select t.rate_type_id,
t.rate_desc,
t.rate_year,
t.rate_base_year,
t.rate_value,
t.cnt,
t.rn,
r.result + t.rate_value + r.result * t.rate_value * 0.01 result
from r,
t
where t.rate_type_id = r.rate_type_id
and t.rn = r.rn + 1
select *
from (
select rate_desc name,
rate_year,
result
from r
where rn <= cnt
pivot (sum(result) for rate_year in (2012,2013,2014))
order by name
NAME 2012 2013 2014
Desc1 5.914908 7.2918018 8.79388703
Desc2 5.914908 7.2918018 8.79388703
SQL> Obviously pivoting assumes you know rate_year values upfront. If not, then without pivoting:
with t as (
select a.rate_type_id,
rate_desc,
rate_year,
rate_base_year,
rate_value,
count(*) over(partition by a.rate_type_id) cnt,
row_number() over(partition by a.rate_type_id order by rate_year) rn
from rate_type a,
rates b
where a.rate_type_id = b.rate_type_id
r(
rate_type_id,
rate_desc,
rate_year,
rate_base_year,
rate_value,
cnt,
rn,
result
) as (
select rate_type_id,
rate_desc,
rate_year,
rate_base_year,
rate_value,
cnt,
rn,
rate_base_year + rate_value + rate_base_year * rate_value * 0.01 result
from t
where rn = 1
union all
select t.rate_type_id,
t.rate_desc,
t.rate_year,
t.rate_base_year,
t.rate_value,
t.cnt,
t.rn,
r.result + t.rate_value + r.result * t.rate_value * 0.01 result
from r,
t
where t.rate_type_id = r.rate_type_id
and t.rn = r.rn + 1
select rate_desc name,
rate_year,
result
from r
where rn <= cnt
order by name,
rate_year
NAME RATE_YEAR RESULT
Desc1 2012 5.914908
Desc1 2013 7.2918018
Desc1 2014 8.79388703
Desc2 2012 5.914908
Desc2 2013 7.2918018
Desc2 2014 8.79388703
6 rows selected.
SQL> SY. -
AUR helper with download/build only option ?
Hi,
Currently I have a cron job that does this:
pacman -Syuw --noconfirm
This downloads all packages and put it in the cache in the background, this way when a run an upgrade I just have to validate.
I would like to have the same for AUR packages. Is anyone aware of a AUR helper with a "download+build" only option ?pacaur (which uses cower) supports a -d flag to download only, and a -m flag to download and build. The -d flag will pull down dependencies. I'm quite happy with pacaur+cower as a day to day solution, $0.02.
EDIT: sorry I meant the -m flag pulls down deps -- to do it with the -d flag you have to specify it twice. </bourbon>
Last edited by TE (2014-12-13 00:53:36) -
Help with conditional build expressions
I'm using RoboHelp HTML and creating WebHelp Pro layouts. I
want to create five (or more) different versions of the Help tool
for our various groups of users.
Here's what I'd like to do: Create a conditional build tag
for each of the versions (i.e. each of our groups of users). I
could name them as follows:
group1
group2
group3
group4
group5
Then, I would associate each topic with one or more of the
build tags. For example, topic1 may be for group1 and group2;
topic2 may be for group1 and group4. Etc.
The problem is thus: When I want to create the version for,
say, group1, my expression ends up excluding the other groups. In
the end, this omits any topics associated with group1 that are also
associated with the other build tags (i.e. the other groups).
Is there an expression I can use to prevent these topics from
being omitted? Perhaps the use of parentheses?
The only solution I've used is tedious: I create many build
tags--one for each variation. For example, I'd have a
group1group2group3 build tag, a group1group3 build tag, a
group1group4 build tag, etc. Then, I just associate one build tag
with each topic. When I'm creating a version for group1, for
example, I'd just include all topics with a build tag that includes
group1 (e.g. group1, group1group3, group1group2group3, et. al.). I
omit the others (e.g. group2group3, group2group4,
group2group3group4group5...et. al.).
As you can imagine, this solution is problematic. First, I
have to create and keep track of many many build tags. Then, if I
want to create another version of Help, I need to change all the
build tags to include this new group.
I'm sure there must be a better build tag expression for what
I'm trying to accomplish. Please help! Thanks!There is indeed an expression! Unfortunately, the option is
normally hidden, so it can be tricky to find. Here's what you do:
1. Define the build tags.
2. Apply them to your topics. OVERLAPPING IS ENCOURAGED! That
is to say, you can assign tag1, tag2, and tag3 to a single topic.
3. Right-click the desired layout and select Properties.
4. Click the Define button to the right of the Conditional
Build Tag drop-down menu. The Define Conditional Build Tag
Expression dialog will appear.
5. Click the Advanced button. The Advanced area will appear
at the bottom of the dialog.
6. Select a tag from the Available Conditional Build Tags
drop-down menu.
7. Click the Add Tag button. The selected tag will appear in
the Conditional Build Tag Expression display window.
8. Click the AND button.
9. Select another tag from the drop-down menu.
10. Click the Add Tag button.
11. Repeat steps 8-10 for each tag you wish to add to the
expression.
12. Click the OK button to close the dialog.
13. Click the Save button to save your layout with the new
build expression.
That's it! The trick is to use the ADVANCED button in the
Define Conditional Build Tag Expression dialog. Doing so allows you
to build inclusional expressions rather than exclusional
expressions, so you can avoid the hassle you described in your
post. Using this method, I defined two build tags (A and B) and
applied them to three topics as follows:
* Topic 1: Tag A
* Topic 2: Tag B
* Topic 3: Tags A and B
I then defined an expression that simply included tag A. When
I compiled my help, topics 1 and 3 appeared in the output, but
topic 2 did not. -
All,
I am new to using Query Builder, but I found a tutorial at:
http://otn.oracle.com/products/forms/htdocs/d2k/qb/qb1.htm
When I got to the last slide, it make reference to the "Query Builder Online Help", but I cannot find it. Can anyone help?Hi,
http://www.oracle.com/technology/products/database/application_express/index.html
http://www.oracle.com/technology/products/database/application_express/html/doc.html
Good Reading,
Sim -
Hello, I have the following query that I'm running in Oracle SQL Developer 1.2.1
WITH group_by_4_column_results AS
(SELECT m_atschunk.employee AS employee,
SUM(CASE
WHEN
M_ATSCHUNK.rolloffDaysCount = '108545043' AND m_atschunk.infractiondate BETWEEN SYSDATE - 365 AND SYSDATE THEN 1 ELSE 0 END) as rolloffs,
M_ATSCHUNK.INFRACTIONDATE + 365 as infractionDate
FROM M_ATSCHUNK
group by employee, infractionDate, rolloffDaysCount
SELECT g4.*,
SUM (rolloffs) OVER (PARTITION BY employee) AS total_rolloffs
FROM group_by_4_column_results g4
It will output the key elements of what I need. But where it sums up the 'total_rolloffs', I need to add that number back into the infractiondate column. Any help would be greatly appreciated.
CREATE TABLE M_ATSCHUNK
(EMPLOYEE varchar(50),
ROLLOFFDAYSCOUNT varchar(3),
INFRACTIONDATE date)
INSERT INTO M_ATSCHUNK (EMPLOYEE, ROLLINGOFFDAYSCOUNT, INFRACTIONDATE)
VALUES ('PHIL','YES', (to_date('2010/01/01 08:00:00', 'yyyy/mm/dd hh24:mi:ss'))),
VALUES ('PHIL','YES', (to_date('2010/01/02 08:00:00', 'yyyy/mm/dd hh24:mi:ss'))),
VALUES ('PHIL','YES', (to_date('2010/01/03 08:00:00', 'yyyy/mm/dd hh24:mi:ss'))),
VALUES ('PHIL','YES', (to_date('2010/01/04 08:00:00', 'yyyy/mm/dd hh24:mi:ss'))),
VALUES ('PHIL','YES', (to_date('2010/01/05 08:00:00', 'yyyy/mm/dd hh24:mi:ss'))),
VALUES ('PHIL','NO', (to_date('2010/02/01 08:00:00', 'yyyy/mm/dd hh24:mi:ss'))),
VALUES ('PHIL','NO', (to_date('2010/03/01 08:00:00', 'yyyy/mm/dd hh24:mi:ss'))),
VALUES ('NIKI','YES', (to_date('2010/01/01 08:00:00', 'yyyy/mm/dd hh24:mi:ss'))),
VALUES ('NIKI','YES', (to_date('2010/01/01 08:00:00', 'yyyy/mm/dd hh24:mi:ss'))),
VALUES ('NIKI','YES', (to_date('2010/01/01 08:00:00', 'yyyy/mm/dd hh24:mi:ss'))),
VALUES ('NIKI','NO', (to_date('2010/01/01 08:00:00', 'yyyy/mm/dd hh24:mi:ss'))),
VALUES ('NIKI','NO', (to_date('2010/01/01 08:00:00', 'yyyy/mm/dd hh24:mi:ss'))),
VALUES ('NIKI','NO', (to_date('2010/01/01 08:00:00', 'yyyy/mm/dd hh24:mi:ss'))),
VALUES ('NIKI','NO', (to_date('2010/01/01 08:00:00', 'yyyy/mm/dd hh24:mi:ss')))Phil3061 wrote:
I need to add that number back into the infractiondate column.Well, in general you need to use UPDATE or better MERGE. Howebver, your data sample does not show any rollofs:
SQL> SELECT * FROM M_ATSCHUNK;
EMPLOYEE ROL INFRACTIO
PHIL YES 01-JAN-10
PHIL YES 02-JAN-10
PHIL YES 03-JAN-10
PHIL YES 04-JAN-10
PHIL YES 05-JAN-10
PHIL NO 01-FEB-10
PHIL NO 01-MAR-10
NIKI YES 01-JAN-10
NIKI YES 01-JAN-10
NIKI YES 01-JAN-10
NIKI NO 01-JAN-10
EMPLOYEE ROL INFRACTIO
NIKI NO 01-JAN-10
NIKI NO 01-JAN-10
NIKI NO 01-JAN-10
14 rows selected.
SQL> WITH group_by_4_column_results AS
2 (SELECT m_atschunk.employee AS employee,
3 SUM(CASE
4 WHEN
5 M_ATSCHUNK.rolloffDaysCount = '108545043' AND m_atschunk.infractiondate BETWEEN SYSDATE - 365 AND SYSDATE THEN 1 ELSE 0 END) as
rolloffs,
6 M_ATSCHUNK.INFRACTIONDATE + 365 as infractionDate
7 FROM M_ATSCHUNK
8 group by employee, infractionDate, rolloffDaysCount
9 )
10 SELECT g4.*,
11 SUM (rolloffs) OVER (PARTITION BY employee) AS total_rolloffs
12 FROM group_by_4_column_results g4
13 /
EMPLOYEE ROLLOFFS INFRACTIO TOTAL_ROLLOFFS
NIKI 0 01-JAN-11 0
NIKI 0 01-JAN-11 0
PHIL 0 01-JAN-11 0
PHIL 0 02-JAN-11 0
PHIL 0 03-JAN-11 0
PHIL 0 04-JAN-11 0
PHIL 0 05-JAN-11 0
PHIL 0 01-FEB-11 0
PHIL 0 01-MAR-11 0
9 rows selected.
SQL> So adjust data sample and based on it tell us what are the expected results.
SY. -
Need help with query that can look data back please help.
hi guys i have a table like such
CREATE TABLE "FGL"
"FGL_GRNT_CODE" VARCHAR2(60),
"FGL_FUND_CODE" VARCHAR2(60),
"FGL_ACCT_CODE" VARCHAR2(60),
"FGL_ORGN_CODE" VARCHAR2(60),
"FGL_PROG_CODE" VARCHAR2(60),
"FGL_GRNT_YEAR" VARCHAR2(60),
"FGL_PERIOD" VARCHAR2(60),
"FGL_BUDGET" VARCHAR2(60)
)and i have a data like such
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','11','1','400');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','10','1','100');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','1','0');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','14','200');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','10','14','100');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','10','2','100');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7470','4730','02','10','2','200');I bascially need to get the total of the budget column. however its not as simple as it sound(well atleast not for me.) the totals carry over to the new period. youll noticed the you have a period column. basically what im saying is that
fgl_grant_year 10 period 1 = for account 7600 its $100 and $100 for period 2 you see 100 dollars again this is not to be added this is the carried over balance. which remains $100.
so im trying to write a query that basically does the following.
im given a period for the sake of this example lets say period 1 i get nothing else. I have to find the greates grant year grab the amount for period 14(which is the total from the previous year) and add it to the amount of the current period. in this case period 1 grnt_year 11
so the expected outcome should be $700
240055 240055 7240 4730 02 10 14 200
240055 240055 7600 4730 02 10 14 100
240055 240055 7600 4730 02 11 1 400keep in mind that im not given a year just a period.
any help that you guys can offer would be immensely appreciated. I have been trying to get this to work for over 3 days now.
finally broke down and put together this post
Edited by: mlov83 on Sep 14, 2011 8:48 PMFrank
wondering if you can help me modify this sql statement that you provided me with .
table values have been modified a bit.
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','11','00','400');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','1','100');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','1','0');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','11','1','400');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('360055','360055','7200','4730','02','10','1','400');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('360055','360055','7600','4730','02','10','1','400');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','14','200');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','10','14','100');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','14','200');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','2','100');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','11','2','600');i need to take one more thing into consideration. if the greatest year has a value on period 00 i need to ignore the period 14 and the current period total would be
the current period +(current period - greatest year 00)
hope that makes sense so in other words with the new data above. if i was querying period two of grant year 11. i would end up with $800
because the greatest year is 11 it contains a period 0 with amount of $400 so my total should be
period 2 amount $ 600
period 0 amount $ 400 - period 2 amount of $600 = 200
600+200 = $800
if i query period 1 of grant 360055 i would just end up with 800 of grnt year 10.
i have tried to modify that query you supplied to me with no luck. I have tried for several day but im embarrased to say i just can get it to do what im trying to do .
can you please help me out.
Miguel -
Need Help With Query Using Aggregation
If I have a table, defined like this:
CREATE TABLE range_test
range_id NUMBER(20) NOT NULL,
grade CHAR(1) NOT NULL,
lower_bound_of_range NUMBER(5,2) NOT NULL,
upper_bound_of_range NUMBER(5,2) NOT NULL,
received_date_time_stamp TIMESTAMP DEFAULT SYSTIMESTAMP NOT NULL
And I wanted to query the table to find the range associated with the last inserted row for each 'grade' (e.g. 'A', 'B', 'C', etc), how would I go about that?
I want something like the following, but I know that this won't work right:
SELECT
grade,
lower_bounding_of_range,
upper_bounding_of_range,
max(received_date_time_stamp)
FROM
range_test GROUP BY received_date_time_stamp;
Thanks for your help. . .I'm frustrating myself with this one and I think it should be possible without having to use PL/SQL (i.e. SQL aggregate functions or sub-queries should work).Perhaps something along the lines of...
SQL> ed
Wrote file afiedt.buf
1 select deptno, empno, ename, hiredate
2 from emp
3* order by deptno, empno
SQL> /
DEPTNO EMPNO ENAME HIREDATE
10 7782 CLARK 09-JUN-1981 00:00:00
10 7839 KING 17-NOV-1981 00:00:00
10 7934 MILLER 23-JAN-1982 00:00:00
20 7369 SMITH 17-DEC-1980 00:00:00
20 7566 JONES 02-APR-1981 00:00:00
20 7788 SCOTT 19-APR-1987 00:00:00
20 7876 ADAMS 23-MAY-1987 00:00:00
20 7902 FORD 03-DEC-1981 00:00:00
30 7499 ALLEN 20-FEB-1981 00:00:00
30 7521 WARD 22-FEB-1981 00:00:00
30 7654 MARTIN 28-SEP-1981 00:00:00
30 7698 BLAKE 01-MAY-1981 00:00:00
30 7844 TURNER 08-SEP-1981 00:00:00
30 7900 JAMES 03-DEC-1981 00:00:00
14 rows selected.
SQL> ed
Wrote file afiedt.buf
1 select deptno, empno, ename, hiredate
2 from (
3 select deptno, empno, ename, hiredate
4 ,row_number() over (partition by deptno order by hiredate desc) as rn
5 from emp
6 )
7 where rn = 1
8* order by deptno, empno
SQL> /
DEPTNO EMPNO ENAME HIREDATE
10 7934 MILLER 23-JAN-1982 00:00:00
20 7876 ADAMS 23-MAY-1987 00:00:00
30 7900 JAMES 03-DEC-1981 00:00:00
SQL> -
Hi,
Good day everyone! I need help writing a query. I have this table with the following data in them...
ACCT_CODE FSYR YTD_AMT
A123 11 100
A456 11 200
A123 10 50
A456 10 100I want the output to look like this:
ACCT_CODE CURRENT_YEAR(11) PRIOR_YEAR(10)
A123 100 50
A456 200 100The user will input the fiscal year and based on that input, I want to get the prior year value as well.
Thank you for all your help!!
Edited by: user5737516 on Jun 29, 2011 6:48 AM
Edited by: user5737516 on Jun 29, 2011 6:50 AMuser5737516 wrote:
Hi,
Good day everyone! I need help writing a query. I have this table with the following data in them...
ACCT_CODE FSYR YTD_AMT
A123 11 100
A456 11 200
A123 10 50
A456 10 100
I want the output to look like this:
ACCT_CODE CURRENT_YEAR PRIOR_YEAR
A123 100 50
A456 200 100
The user will input the fiscal year and based on that input, I want to get the prior year value as well.
Thank you for all your help!!what is prior year? -
Query off of Oracle using WinSql - Need help with query
I am trying to query off of Oracle using program WinSql.
I have a table(tticpr200110) that has the following sample data:
ITEM CODE T$AMNT
23500076 ACL .0049
23500076 APM 0
23500076 APO .0093
23500076 EXP .0001
23500076 RES .0072
and what I want it to look like is:
ITEM ACL APM APO EXP RES
23500076 0.0049 0 0.0093 0.0001 0.0072
(actually I need the last 2 columns added together to be MATL-but can deal with that down the road).
Seems simple enough, but I don't know to put into the columns.
Any help would be GREATLY appreciated as soon as possible would be even better.My table - tticpr200110 when it runs I get the following sample data for part number 23500076:
The first coloumn ITEM is the part number.
The second column CODE is 1 of 5 different cost codes
The third column is the cost for that code for that part.
ITEM CODE AMNT
23500076 ACL 0.0049
23500076 APM 0.0000
23500076 APO 0.0093
23500076 EXP 0.0001
23500076 RES 0.0072
I want to make a query that makes the data look like this:
ITEM ACL APM APO EXP RES
23500076 0.0049 0.0000 0.0093 0.0001 0.0072
(similar to a pivot table in excel or acess)
I hope this helps better.
Thanks! -
Need help with Query to determine Credit Memos and Invoices
Hi All
Thanks for all the help here.
I need a query to determine any credits or invoices issued within a given period.
OINV and ORIN with UNION ALL?
Please advise any help.
Thank you!Hi Daniel,
Please check below Query.
SELECT T0.[DocNum] as 'Invice No', T0.[DocDate] as 'Invoice Date', T0.[CardName] as 'Invoiced Customer', T3.[DocNum] as 'Credit Memo No', T3.[DocDate] as 'Credit Mamo Date', T3.[CardName] as 'Credit Memo Customer' FROM OINV T0 LEFT JOIN INV1 T1 ON T0.[DocEntry] = T1.[DocEntry] LEFT JOIN RIN1 T2 ON T2.[BaseEntry] = T1.[DocEntry] AND T2.[BaseLine] = T1.[LineNum] LEFT JOIN ORIN T3 ON T2.[DocEntry] = T3.[DocEntry] WHERE T0.[DocDate] >=[%3] AND T0.[DocDate] <=[%4]
Hope this helps
Regards::::
Atul Chakraborty -
[Oracle 8i] Help with query performance
The following query is running VERY slowly for me:
SELECT oord.part_nbr
, sopn.ord_nbr
, sopn.sub_ord_nbr
, sopn.major_seq_nbr
, sopn.wctr_id
, sopn.oper_desc
, SUM(pact.act_dlrs_earned+pact.act_brdn_dls_earned+pact.tool_dlrs_earned+pact.act_fix_brdn_dls_ea)
, pact.activity_date
FROM PACT pact
, SOPN sopn
, OORD oord
WHERE pact.order_nbr = sopn.ord_nbr AND
pact.maj_seq_nbr = sopn.major_seq_nbr AND
sopn.sub_ord_nbr = pact.sub_order_nbr AND
sopn.ord_nbr = oord.ord_nbr AND
sopn.sub_ord_nbr = oord.sub_ord_nbr AND
pact.activity_date >= ? AND
sopn.rework_ind = 'N' AND
(oord.part_nbr, sopn.major_seq_nbr, sopn.wctr_id)
NOT IN (
SELECT rout.doc_nbr
, rout.major_seq_nbr
, rout.wctr_id
FROM ROUT rout
WHERE (rout.begn_eff_dt <=SYSDATE) AND
(rout.end_eff_dt >SYSDATE) AND
(rout.po_rework_ind ='N')
GROUP BY oord.part_nbr
, sopn.ord_nbr
, sopn.sub_ord_nbr
, sopn.major_seq_nbr
, sopn.wctr_id
, sopn.oper_desc
, pact.activity_dateI sent a request off to my IT department (specifically asking for the explain plan and tkprof, as described in the [main post on this topic|http://forums.oracle.com/forums/thread.jspa?threadID=501834] ), and they replied with a screen shot of the 'explain plan' the tool they use (Toad) provides.
!http://temp-sample.webs.com/explain_plan.jpg!
I don't know if anyone can help me based off this, since I know it's not really what the main post says to provide, but it's all I was given.
My IT department also made a few changes to my original query (see below) and told me it got rid of one of the full scans of the PACT table, but they aren't sure why it helped, and I have to say I'm suspect of any fixes where it's not understood why it helped.
SELECT oord.part_nbr
, sopn.ord_nbr
, sopn.sub_ord_nbr
, sopn.major_seq_nbr
, sopn.wctr_id
, sopn.oper_desc
, SUM(pact.act_dlrs_earned+pact.act_brdn_dls_earned+pact.tool_dlrs_earned+pact.act_fix_brdn_dls_ea)
, pact.activity_date
FROM PACT pact
, SOPN sopn
, OORD oord
WHERE sopn.ord_nbr = pact.order_nbr AND
sopn.major_seq_nbr = pact.maj_seq_nbr AND
pact.sub_order_nbr = sopn.sub_ord_nbr AND
oord.ord_nbr = sopn.ord_nbr AND
oord.sub_ord_nbr = sopn.sub_ord_nbr AND
(pact.activity_date >= ?) AND
'N' = sopn.rework_ind AND
pact.order_nbr = oord.ord_nbr AND
oord.sub_ord_nbr = pact.sub_order_nbr AND
(oord.part_nbr, pact.maj_seq_nbr, sopn.wctr_id) NOT IN
SELECT /*+ INDEX_JOIN(ROUT) */ rout.doc_nbr
, rout.major_seq_nbr
, rout.wctr_id
FROM ROUT rout
WHERE rout.begn_eff_dt <= SYSDATE AND
rout.end_eff_dt > SYSDATE AND
'N' = rout.po_rework_ind
GROUP BY oord.part_nbr
, sopn.ord_nbr
, sopn.sub_ord_nbr
, sopn.major_seq_nbr
, sopn.wctr_id
, sopn.oper_desc
, pact.activity_dateAny help on this would be appreciated... when I run this (right now) for 2-3 months of data, it takes a minimum of 3 hours to complete, and I'll eventually need to run this for up to a year's worth of data.Hi,
Well, let's see.
You get 156 rows returned using IN and 121 rows using exists.
You need identify the 'missing records' and conclude if that's correct or not, I'm not able to do that from remote, without knowing your data or system.
It would be helpful if we could see cost and cardinalities, you (or your IT dept.) can get them easily be running the queries from your SQL*Plus prompt.
Type
SET AUTOTRACE TRACEONLYbefore running the queries.
That gives you the explain plan and additional statistics (sorts in memory and sorts to disk).
Since you use a group by, and you're on 8i can you also post results of these queries:
select banner from v$version;
select name, value, isdefault from v$parameter where name like '%area%';Finally, does below query give you a different plan?
select oord.part_nbr
, oord.ord_nbr
, oord.sub_ord_nbr
, pact.major_seq_nbr
, sopn.wctr_id
, sopn.oper_desc
, sum(pact.act_dlrs_earned + pact.act_brdn_dls_earned + pact.tool_dlrs_earned + pact.act_fix_brdn_dls_ea)
, pact.activity_date
from oord oord
, pact pact
, sopn sopn
where oord.ord_nbr = pact.order_nbr
and oord.sub_ord_nbr = pact.sub_order_nbr
and oord.ord_nbr = sopn.ord_nbr
and oord.sub_ord_nbr = sopn.sub_ord_nbr
and sopn.major_seq_nbr = pact.maj_seq_nbr
and (pact.activity_date >= ?)
and 'N' = sopn.rework_ind
and (oord.part_nbr, pact.maj_seq_nbr, sopn.wctr_id) not in ( select rout.doc_nbr
, rout.major_seq_nbr
, rout.wctr_id
from rout rout
where rout.begn_eff_dt <= sysdate
and rout.end_eff_dt > sysdate
and 'N' = rout.po_rework_ind)
group by oord.part_nbr
, oord.ord_nbr
, oord.sub_ord_nbr
, pact.major_seq_nbr
, sopn.wctr_id
, sopn.oper_desc
, pact.activity_date
Maybe you are looking for
-
Windows 7 Home Premium Pre Installed OS Clarificat​ion
REF SKU #3495331, Samsung Series 7 Laptop/Intel i7 Core Processor/ 15.6" Display/ 6 GB Memory/ 750 GB hard drive Within the full details of the product, "Overview" tab first bullet "Windows 7 Home Premium Installed" Further down on the same "Overview
-
Do you have any suggestions?
-
Can't drag and drop music to iphone5
I updated to the latest Itunes, plugged my new Iphone5 in and "restore from previous Iphone back up" It did it fine, then i went to manage music manually and checked the boxes for all the artists I wanted on my new phone. Sync it to my phone and al
-
Strange Facet of Imported Graphic: ò\e2
Hello Framers, I am using Frame 7.1 and have just taken over a project from a colleague who is sometimes, er, careless with best practices. So I MIF-washed all files (replacing all OLE2 graphics) and tried to save as RTF. Frame crashed. I looked at t
-
Notes has stoped sync with icloud after I upgraded to 7.0.2?
Notes (on my iPhone and iPad) has stoped sync with icloud after I upgraded to 7.0.2. All others items like Contacts, Calendars, etc. are able to sync. any solutions.