Multiple Conditions in a Query - BW v3.5
Hello all,
I have created a query with 2 conditions: Revenue > 0 and Bottom 10 Customers (Customers are displayed in a hierarchy based on Country). However, when the query runs the ranking condition seems to run first, picking up the bottom 10, but then those with 0 revenue are removed, in some cases leaving a bottom 7, or 6, or whatever is left.
How can I make the Revenue > 0 condition be applied first?
Thanks for your help.
Thanks, this solves the problem (points awarded!).
Is it the only way? Or is there an answer to running the conditions in the correct order?
Similar Messages
-
Multiple Conditions in a Query
Hi,
I have one Characteristic and 3 KeyFigures (mentioned below in quotes) in a Query and I would like to have following Conditions built in the query:
1. Top N Condition on "Net Sales"
2. Only display "Costs" > 0
3. Only display "Quantities" > 10
For some reason, it is not working as desired whether I combine them in one Condition or create 3 different Conditions in the Query. Does anyone have any idea?
Thanks
SriniHi Srini,
What exactly is wrong?
In case of three separate conditions try to activate the 1st one, then the 2nd one, and finally - the 3rd one.
If on one of these steps you'll get a message about non applicability, then your conditions conflict with each other.
See examples of using conditions here:
http://help.sap.com/saphelp_nw04s/helpdata/en/0b/f584409db95537e10000000a1550b0/frameset.htm
Best regards,
Eugene -
How to insert 2 conditions in a Query
Hi ,
How can i apply 2 conditions to a query
First i need to apply a condition X to query and then i need to apply condition Y to the results which are based on condition X
How can i acheve thisHi
We can create multiple condition in one query
When ever u select condition on tab it shows two options Chenge condition and new condition
If we have 2 comndition in one query it works with AND function .
If we have all applicable condition in one condition then it works with OR functionality.
Assign points -
Hi Experts,
I have a problem of trying to utilize multiple conditions on a query. I have two conditions like this:
keyfigure A < 0
keyfigure A Bottom 10
What is happening is that it is finding the bottom 10 values and then filtering out the values. So instead of displaying 10 values, I only get a few.
I have tried changing the order of the conditions and such, but it doesn't seem to affect the results. I currently have the two conditions mentioned above in separate conditions. (My understanding is that this produces an AND effect.)
Any thoughts on how to force it to do the filtering first and then order?
Thanks in advance.Have you tried using a pre-query? That way, the first selection is forced to happen before the second.
Here's the Help documentation... once you understand how to use it, its very powerful.
http://help.sap.com/saphelp_nw04/helpdata/EN/2c/78a03c1178ad2ce10000000a114084/content.htm
Points?
PAtrick -
Multiple Conditions in BEx 3.5 Query
Hello All,
I am using BEx 3.5 and I have two single line conditions in my query. One is set to "All Characteristics in the Drilldown Independently" and the other is set to "Single Characteristics or Comginations of Characteristics". Each Condition works when only one is active. When both are active, the one set to "All Characteristics in the Drilldown Independently" does not work. It has a check in front of it indicating that it is active, but it does not work properly. Is it possible to have two conditions active at the same time when one is set to "All ....." and the other is set to "Single....".
Any help would be appreciated!!
Thanks!
TinaHI Tina,
2 conditions at same time can't work on one characteristic in 2 different way. this is something like finding 1 red apple or 2 green apple in a pack up 4 apples say. which is not possible either you have 1st search for 1 and then for 2 or 1st 2 and then for 1.
when both the conditions are active i think the condition "Single Characteristics or Comginations of Characteristics" was after the condition "All Characteristics in the Drilldown Independently" in the designer and thats why its overwriting the other. you may decide logically which condition should be applied 1st and then from that out come, if the other condition is applicable then if it works for the desired out put. else you can make both the condition of same type either All char or single char.
i think you should put the condition "all char" for both and it should work.
you can also decide one primary condition and apply that one only and the other condition you can achieve using a RKF.
hope this helps. -
How can I pass multiple condition in where clause with the join table?
Hi:
I need to collect several inputs at run time, and query the record according to the input.
How can I pass multiple conditions in where clause with the join table?
Thanks in advance for any help.
Regards,
TDIf you are using SQL-Plus or Reports you can use lexical parameters like:
SELECT * FROM emp &condition;
When you run the query it will ask for value of condition and you can enter what every you want. Here is a really fun query:
SELECT &columns FROM &tables &condition;
But if you are using Forms. Then you have to change the condition by SET_BLOCK_PROPERTY.
Best of luck! -
Understanding multiple conditions in connect by prior clause Oracle
Hi ,
Can some one please explain me how to comprehend/understand multiple conditions in connect by prior conditions with some example data.
I am creating a table like this
CREATE TABLE FAMiLY_TREE
GRAND_FATHERID number,
FATHER_ID number,
SON_ID number,
person_name varchar(20)
INSERT INTO FAMILY_TREE (GRAND_FATHERID ,FATHER_ID , SON_ID , PERSON_NAME ) VALUES
(NULL, NULL , 5 , 'Mr X ' );
INSERT INTO FAMILY_TREE (GRAND_FATHERID ,FATHER_ID , SON_ID , PERSON_NAME ) VALUES
(null, 5 , 6 , 'Dave' );
INSERT INTO FAMILY_TREE (GRAND_FATHERID ,FATHER_ID , SON_ID , PERSON_NAME ) VALUES
(5, 6 , 7 , 'Vinny' );
INSERT INTO FAMILY_TREE (GRAND_FATHERID ,FATHER_ID , SON_ID , PERSON_NAME ) VALUES
(5, 6 , 16 , 'Omy' );
INSERT INTO FAMILY_TREE (GRAND_FATHERID ,FATHER_ID , SON_ID , PERSON_NAME ) VALUES
(5, 6 , 17 , 'Vijjy' );
INSERT INTO FAMILY_TREE (GRAND_FATHERID ,FATHER_ID , SON_ID , PERSON_NAME ) VALUES
(6, 7 , 8 , 'Vicky' );
INSERT INTO FAMILY_TREE (GRAND_FATHERID ,FATHER_ID , SON_ID , PERSON_NAME ) VALUES
(6, 7 , 9 , 'Varis' );
INSERT INTO FAMILY_TREE (GRAND_FATHERID ,FATHER_ID , SON_ID , PERSON_NAME ) VALUES
(7, 8 , 10 , 'Vshnu' );
INSERT INTO FAMILY_TREE (GRAND_FATHERID ,FATHER_ID , SON_ID , PERSON_NAME ) VALUES
(7, 8 , 11 , 'dyna' );
INSERT INTO FAMILY_TREE (GRAND_FATHERID ,FATHER_ID , SON_ID , PERSON_NAME ) VALUES
(8, 10 , 14 , 'Marry' );
INSERT INTO FAMILY_TREE (GRAND_FATHERID ,FATHER_ID , SON_ID , PERSON_NAME ) VALUES
(8, 10 , 15 , 'Mac' );
INSERT INTO FAMILY_TREE (GRAND_FATHERID ,FATHER_ID , SON_ID , PERSON_NAME ) VALUES
(7, 9 , 12 , 'Garry' );
INSERT INTO FAMILY_TREE (GRAND_FATHERID ,FATHER_ID , SON_ID , PERSON_NAME ) VALUES
(7, 9 , 13 , 'Ganny' );
SELECT
LPAD(' ', LEVEL*3) || PERSON_NAME FROM FAMILY_TREE
START WITH SON_ID= 6
CONNECT BY PRIOR SON_ID = FATHER_ID
AND PRIOR FATHER_ID = GRAND_FATHERID ;
SELECT
LPAD(' ', LEVEL*3) || PERSON_NAME FROM FAMILY_TREE
START WITH SON_ID= 6
CONNECT BY PRIOR SON_ID = FATHER_ID ;
Both These query return the same o/p
Dave
Vinny
Vicky
Vshnu
Marry
Mac
dyna
Varis
Garry
Ganny
Omy
Vijjy
Can some one please explain me comprehension of both these query or give me a example where i can understand multiple connect by prior conditions
ThanksMaybe (something to play with)
with
family_tree as
(select 'Green' family,null ancestor,1 person,'Mr X' person_name,1900 born from dual union all
select 'Green',1,2,'Dave',1920 from dual union all
select 'Green',2,3,'Vinny',1940 from dual union all
select 'Green',2,4,'Omy',1945 from dual union all
select 'Green',2,5,'Vijjy',1950 from dual union all
select 'Green',3,6,'Vicky',1960 from dual union all
select 'Green',3,7,'Varis',1965 from dual union all
select 'Green',6,8,'Vshnu',1980 from dual union all
select 'Green',6,9,'Dyna',1985 from dual union all
select 'Green',8,10,'Mary',2000 from dual union all
select 'Green',8,11,'Mac',2005 from dual union all
select 'Green',7,12,'Garry',1985 from dual union all
select 'Green',7,13,'Ganny',1990 from dual union all
select 'Brown',null,14,'Joe',1950 from dual union all
select 'Brown',14,15,'Jim',1970 from dual union all
select 'Brown',14,16,'Joy',1975 from dual union all
select 'Brown',14,17,'Jay',1980 from dual union all
select 'Brown',16,18,'Jack',1995 from dual union all
select 'Brown',18,19,'Jake',2010 from dual union all
select 'Brown',18,20,'Jess',2012 from dual
select family,
root_name||' ('||to_char(root_born)||')' "(FA/MO)THER",
children
from (select family,
root_born,
root_name,
ltrim(sys_connect_by_path(person_name||' ('||to_char(born)||')',', '),', ') children
from (select family,
connect_by_root(person_name) root_name,
connect_by_root(born) root_born,
person_name,
born,
row_number() over (partition by family,connect_by_root(person_name) order by born) rn
from family_tree
where level = 2
connect by prior person = ancestor
where connect_by_isleaf = 1
start with rn = 1
connect by prior root_name = root_name
and prior family = family
and prior rn + 1 = rn
order by family desc,root_born
Regards
Etbin -
Multiple conditions while taking export
hi,
when i'm trying to take export using multiple condition,
< EXP query='where branch_code=0130 and loan_date> 01-jan-2005' file=d:\yyy tables=xxxxx>
I get an error 'failed to process parameters'
can anybody help me to solve this
Regardshi satish
this is the exact query
EXP query='where branch_code=0130 and loan_date> 01-jan-2005' file=d:\yyy tables=xxxxx userid=zz/xxx@test
server and client -9i -
Outer Joins with multiple conditions - alternatives to UNION?
It is my understanding that Oracle 8i does not directly support mutiple conditions for outer joins. For instance, I'm looking for PEOPLE who may, or may not, be on MEDICATIONS.
All MEDICATIONS are listed with DRUGNAME and DRUGID. There thousand of different drugs. I'm only looking for PEOPLE on either one or two of them (to make it simple) or no drug at all (ignoring all other DRUGS they're on..) IF they are on the DRUG, it's gerts printed.
I'd ideally do a LEFT OUTER JOIN to do this with multiple conditions:
SELECT DISTINCT
PERSON.NAME,
MEDICATION.DRUGNAME,
MEDICATION.DRUGID
FROM
PERSON,
MEDICATION
WHERE
PERSON.ID = MEDICATION.ID (+) AND
(MEDICATION.DRUGID (+) = 632 OR
MEDICATION.DRUGID (+) = 956)
This, of course, is not valid, at least in 8i...
So I've taken the UNION approach:
SELECT DISTINCT
PERSON.NAME,
MEDICATION.DRUGNAME,
MEDICATION.DRUGID
FROM
PERSON,
MEDICATION
WHERE
PERSON.ID = MEDICATION.ID (+) AND
MEDICATION.DRUGID (+) = 632
UNION
SELECT DISTINCT
PERSON.NAME,
MEDICATION.DRUGNAME,
MEDICATION.DRUGID
FROM
PERSON,
MEDICATION
WHERE
PERSON.ID = MEDICATION.ID (+) AND
MEDICATION.DRUGID (+) = 956
This of course, does work, but as I've added more drugs this becomes quite unwieldly and not really sure what this does to performance. (There are also several more joins to other tables, not relevent here.)
In addition, if I import this into Crystal Reports 8.5 (as opposed to the Crystal Query Designer), it refuses to recognize the UNION.
-- Any suggestions for alternative syntax ???
-- Has this been addressed in 9i ???
Thanks,
WillYou could try
select Distinct Person.Name, Med.DrugName, Med.DrugId
from Person,
(select ID, DrugName, DrugId from Medication
where DrugId in (632, 956) ) Med
where Person.ID = Med.ID(+)
SELECT DISTINCT
PERSON.NAME,
MEDICATION.DRUGNAME,
MEDICATION.DRUGID
FROM
PERSON,
MEDICATION
WHERE
PERSON.ID = MEDICATION.ID (+) AND
(MEDICATION.DRUGID (+) = 632 OR
MEDICATION.DRUGID (+) = 956)
This, of course, is not valid, at least in 8i...
So I've taken the UNION approach:
SELECT DISTINCT
PERSON.NAME,
MEDICATION.DRUGNAME,
MEDICATION.DRUGID
FROM
PERSON,
MEDICATION
WHERE
PERSON.ID = MEDICATION.ID (+) AND
MEDICATION.DRUGID (+) = 632
UNION
SELECT DISTINCT
PERSON.NAME,
MEDICATION.DRUGNAME,
MEDICATION.DRUGID
FROM
PERSON,
MEDICATION
WHERE
PERSON.ID = MEDICATION.ID (+) AND
MEDICATION.DRUGID (+) = 956
This of course, does work, but as I've added more drugs this becomes quite unwieldly and not really sure what this does to performance. (There are also several more joins to other tables, not relevent here.)
In addition, if I import this into Crystal Reports 8.5 (as opposed to the Crystal Query Designer), it refuses to recognize the UNION.
-- Any suggestions for alternative syntax ???
-- Has this been addressed in 9i ???
Thanks,
Will -
Multiple Condition in Single CFL
Dear All,
In my code CFL only recognizes the last condition.So how to set the loop for this condition
If vendorcode = "" Then
SBO_Application.StatusBar.SetText("Please select vendorcode", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
BubbleEvent = False
Exit Sub
Else
Dim i As Integer
i = 0
Dim oCFLs As SAPbouiCOM.ChooseFromListCollection = oForm.ChooseFromLists
oCFL = oCFLs.Item("CFL_6")
oCFL.SetConditions(Nothing)
oCons = oForm.ChooseFromLists.Item("CFL_6").GetConditions
oCon = oCons.Add()
oCon.Alias = "CardCode"
oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL
oCon.CondVal = vendorcode
oCon = oCons.Add()
oCon.Alias = "U_DCSta"
oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL
oCon.CondVal = i
'oCon = oCons.Add()
oForm.ChooseFromLists.Item("CFL_6").SetConditions(oCons)
End If
Regards,
GuruGuru,
Please refer to the following sample code for multiple condition.
'// create a new conditions collection
Set oConditions = SBO_Application.CreateObject(cot_Conditions)
'// Let's assume we wish our query to select
'// Bussines Partners of type "C" (Customers)
'// or "S" (Suppliers)
'// WHERE ((CardType = 'C') Or (CardType = 'S'))
'// the conditions collection encapsulates the WHERE clause
'// of a select statement
Set oCondition = oConditions.Add
'// ((CardType = 'C') Or
oCondition.BracketOpenNum = 2
oCondition.Alias = "CardType"
oCondition.Operation = co_EQUAL
oCondition.CondVal = "C"
oCondition.BracketCloseNum = 1
oCondition.Relationship = cr_OR
Set oCondition = oConditions.Add
'// (CardType = 'S'))
oCondition.BracketOpenNum = 1
oCondition.Alias = "CardType"
oCondition.Operation = co_EQUAL
oCondition.CondVal = "S"
oCondition.BracketCloseNum = 2
Regards, yatsea -
If Statement Multiple Conditions
Using LiveCycle, FormCalc or JavaScript.
I am trying to create an if statement with multiple conditions.
a Sum field calculates a series of numeric input fields. I want the result in the Sum field to determine the expression in a final field.
If the Sum is <30MM then "50000" also if the Sum is >30MM but <60MM then "125000" also if the Sum is >60MM but <100MM then "250000" also if the Sum is >100MM but <300MM then "375000" also if the Sum is >300MM then "500000"
I have only been able to figure out a single if then for the first condition but not able to include the whole set of conditions and the multiple results.
Help would be much Appreciated!
Thank you in advance.Tried a few variations of this and still seem not
to be able to find a solution to this issue. I'm surprised my google searches are bringing up better examples because there seems to be an example of everything else.
Any more detailed advive? -
Options in Assignment of Condition in BEX Query Designer
Hi Experts,
I am trying to define a condition in BEX Query Designer.
I defined my condition and bit confused with Characterstic Assignment
What Happens if is select 9What is the difference)
1) All Characterstic in the Drilldown Independtly
2)Most Detailed Characterstic Along the Rows
3)Most Detailed Characterstic Along Columns and
4)Individual Chars and Chars.Combinations
Thankshi,
chk the link
Query creation
http://help.sap.com/saphelp_nw70/helpdata/EN/f1/0a5625e09411d2acb90000e829fbfe/content.htm
http://help.sap.com/saphelp_nw70/helpdata/EN/42/d21c1f46076bb2e10000000a1553f6/content.htm
Ramesh -
Problem with Conditions in a Query
Hello All,
I have the following Condition in My Query.
Applied Amount Equals to 0. When I run the Query I receive a message 'No Records Exists with the given conditions'. But when I remove the condition and place 'Applied Amount' in the Columns Section I see there are numerous records that Have 'Applied Amount' as 0. What might be the problem?
ThanksHi,
Check out the zero suppression in your BEx analyser and also make sure that when you have defined conditions then you have to select only Applied Amount Charecteristic rather than all the charecteristics.
Hope tis helps...
Assign points if it helps..
Thanks,
Gattu. -
Multiple conditions for the same button.
Is there any way you can have multiple condition (same type of the condition).
I have button that I would like to hide it at different stages.
For example I would like to have a button (Submit) which will be visible when
Status = Draft
Condition Type Value of Item in Expression 1 = Expression 2
P9_X_STATUS
Draft
and when also when userRole = author
Condition Type Value of Item in Expression 1 = Expression 2
P9_X_USER_ROLE
Author
RobertHi,
It would depend on when the fields get their values into the session. They may be below the button on the page but if they have a value in the session then the button's condition will see this.
If, however, you have only used a Default Value setting for the item, the value may not be in the session (even though it may be displayed on the page), so the button will not know about this value. In these cases, I set the default value using a page computation for that item that runs "On Load Before Header" and is conditional on the item being null. That puts the value into the session for other items to use if required.
Andy -
Deleting data from another table with multiple conditions
Hi frnds
I need to delete some data from a table based on multiple condition I tried following sql but its deleteing some rows which is not meeting the criteria which is really dangerours. When i trying = operator it returns ORa- 01427 single -row subquery returns more than one row
delete from GL_TXNS
where TRN_DT in (Select trn_Dt from GL_MAT)
and BR in (select ac_branch from GL_MAT)
and CODE in (select CODE T from GL_MAT)
and (lcy_amt in (select lcy_amt from GL_MAT) or
fcy_amt in(select fcy_amt from GL_MAT)
rgds
ramyaMy answer is the same as Avinash's but I will explain a little bit more.
ORa- 01427 single -row subquery returns more than one rowmeans that you have a subquery that Oracle is expecting one value from that is returning multiple values. In your case you need one value for the equijoin ("=") and you are getting more than one value back. The error happens even if all the values are the same - multiple values being returned will cause the error.
The solution is to either allow multiple values to be returned (say, use the IN condition istead of "=") or only return one value if possible (say, forcing one value by using DISTINCT, GROUP BY, or a WHERE clause condition of ROWNUM=1) - but these workarounds must be checked carefully to make sure they work correctkly
Maybe you are looking for
-
System error -no entry in table T093 for the chart of depreciation or ccode
When checking Depreciation Areas of Company Codes in overview for experts (transaction SPRO) I first get a warning message inconsistent rounding entries were corrected. After saving once in the maintenance transaction (as recommended in the help
-
17" Macbook Pro has become very slow across the board: internet, iTunes, opening programs, downloading updates, etc. It is not my internet connection as all my other devices work fine on my home wireless network connection to cable internet service,
-
Renaming Artist name for groups of songs.
I listen to a lot of classical music. Here the artist name, composer name, and album name can all be screwed up between different music companies where one uses one company uses one field for the artist name and another for the composer name. The oth
-
I have written a java program using jdk1.5. After completing my program I noticed that the compiler was outputting a warning. It tells me that there were a few unsafe operations in my code. Anyway I found out that my code needed to include generics.
-
Cannot access control center when I swipe up checked settings both are on for screen
Since upgrade to iOS 7, I have no access to control center. Any one else with issue?