MDX simple case statement not working?
hi all - any idea what is wrong with this MDX statement? it is returning blank. I am trying to add a calculated measure using the below code but it is not working. thanks for the help.
CASE WHEN [Accounts].[Account Name].CURRENTMEMBER = "Cash" THEN
([Dates].[Hierarchy].currentMember.lastChild, [Measures].[Measures].[Amount]) END
If you are checking for the 'Cash' member of the Account Name hierarchy, do you need to do something like this?
CASE WHEN [Accounts].[Account Name].CURRENTMEMBER IS [Accounts].[Account Name].[Cash] THEN([Dates].[Hierarchy].currentMember.lastChild, [Measures].[Measures].[Amount]) END
Regards,
MrHH
Similar Messages
-
For some reason I am getting an error on a Simple Case Statement
Error (1260052) – Syntax error in input MDX query on line 2 at token ‘)’
Case
When IS(Time.[JAN]) THEN Time.[Feb]
ELSE
Missing
End
Any suggestions.Hi all,
I have a similar problem as i'm not too sure about the correct syntax I should use
CASE
WHEN IS(Time.CurrentMember, Descendants[2007]) THEN .......
ELSE
MISSING
END
How do I incorporate the check for Time.CurrentMember = Descendants of 2007???
Many thanks! -
Case statement not working in rpd
Hi Gurus,
I am giving case statement for the exchange rate column#1 from original exchange rate column , the data of column is like
0.0
0.0
0.1
0.2
1.2
1.3
1.4
so here i dont want 0.0 instead of that i want 1.0 so whenever in next derived column i will calculate it would be this derived exchange rate#1 * inv amt = desired amt
for the same I used different diff. case statement but still 0.0 is not going , I am giving like
1) CASE WHEN BookingsBacklog."Fact USJ Sales Billing"."Loc Exchange Rate" = 0.0 THEN BookingsBacklog."Fact USJ Sales Billing"."Loc Exchange Rate" * 1.0 ELSE BookingsBacklog."Fact USJ Sales Billing"."Loc Exchange Rate" END
2) CASE WHEN BookingsBacklog."Fact USJ Sales Billing"."Loc Exchange Rate" = 0.0 THEN 1.0 ELSE BookingsBacklog."Fact USJ Sales Billing"."Loc Exchange Rate" END
nothing is working , result remains same, any quick help would be apprciated
Thanks,Once again, could you write all information, like I described here my example.
When tried the same it works.
TABLE.COLUMN1 is from dimension.
TABLE.COLUMN1 is DOUBLE in the physical layer (in Oracle it is NUMBER(8,2)) and view/data gives:
TABLE.COLUMN1
12.99
0.00
0.20
In the RPD I made new logical columns.
EXPR:
CASE WHEN "Presentation area".TABLE.COLUMN1 = 0.0 THEN 1.0 ELSE "Presentation area".TABLE.COLUMN1 END
EXPR2:
CASE WHEN "Presentation area".TABLE.COLUMN1 = 0 THEN 1 ELSE "Presentation area".TABLE.COLUMN1 END
Test in Answers:
COLUMN1----EXPR----EXPR2
12.99---------12.99----12.99
0.00-------------1.0--------1.0
0.20------------0.20------0.20
I leaved data format on the column properties as default (override default data format not checked).
I don't see where is the problem.
Regards
Goran
http://108obiee.blogspot.com -
Simple Insert Statement Not Working
This problem is just driving me crazy. I dont know what I m
doing wrong here. The code works fine on my localhost but giving
problem on the live site. It is a simple insert statement like
this:
insert into tblSubImages(productid, title, subdescription,
image, place)
values(#form.productid#,'#form.title#','#form.subdescription#','#uploadedimage#',
#form.place#)
The error I m getting looks like this:
Syntax error in INSERT INTO statement.
The error occurred in
D:\Hosting\davedhillon\superprinters\admin\addaditional.cfm: line
11
9 : <cfset uploadedImage = cffile.serverfile>
10 : <cfquery name="insertadditional"
datasource="#super.dsn#">
11 : insert into tblSubImages(productid, title,
subdescription, image)
values(#form.productid#,'#form.title#','#form.subdescription#','#uploadedimage#')
12 : </cfquery>
13 :
SQL insert into tblSubImages(productid, title,
subdescription, image)
values(1,'ewr','werw','FamilyRoomBedroom.jpg')
DATASOURCE davedhillon_accesscf_super
VENDORERRORCODE 3092
You can see it is the simple insert statement which I have
worked with so many times. Why has it started giving problem all of
a sudden?
Thank youTry copying and pasting the SQL statement produced in the
error into your DB's query analyzer and try running it, as it might
produce a more useful error message so you can see where the
problem exists in the SQL statement. Also, I think I've seen that
3092 code before and it means there is a reserved word violation so
cf_dev2 solution will probably solve it.
CoolJJ -
CASE Statement not working.
I have following case statement in formula to display a specific image if the value from a column is a certain color:
CASE "Facts"."Indicator" WHEN 'Green' THEN '<img src="res/s_blafp/images/green_image.gif" title="Green" </>' WHEN 'Yellow' THEN '<img src="res/s_blafp/images/yellow_image.gif" title="Yellow" </>' WHEN 'Red' THEN '<img src="res/s_blafp/images/red_image.gif" title="Red" </>' END
So far when I use the case statement it only dislpays the following instead of the actual image.
<img src="res/s_blafp/images/green_image.gif" title="Green" </>'shaolin_obiee wrote:
I have following case statement in formula to display a specific image if the value from a column is a certain color:
CASE "Facts"."Indicator" WHEN 'Green' THEN '<img src="res/s_blafp/images/green_image.gif" title="Green" </>' WHEN 'Yellow' THEN '<img src="res/s_blafp/images/yellow_image.gif" title="Yellow" </>' WHEN 'Red' THEN '<img src="res/s_blafp/images/red_image.gif" title="Red" </>' END
So far when I use the case statement it only dislpays the following instead of the actual image.
<img src="res/s_blafp/images/green_image.gif" title="Green" </>'Take a look at this link:
http://gerardnico.com/wiki/dat/obiee/image -
MDX Case Statement not working
Hi have written the following MDX statement to create a new column calledl 'Aon Group' and group the Policy Broker Names into 2 values, either 'Aon' or 'All Other':
WITH Member [Measures].[Aon Group]
as
Case when [Broker].[Policy Broker Name - Big 6].[Policy Broker Name - Big 6].&[Aon] Then "Aon"
Else "All Other"
End
SELECT NON EMPTY
{ [Measures].[Net Premium],[Measures].[Aon Group] }
ON COLUMNS,
NON EMPTY
{ ( [Broker].[Policy Broker Name].[Policy Broker Name].ALLMEMBERS ) }
ON ROWS
FROM [Broker Premium]
Here are my results:
It's giving me #Error and the actual 'Aon' Policy Broker Name is showing 'All Other', which is opposite of what I want.
thanksHi Scott,
Here is a query for your reference.
With Member [Measures].[Test]
As
Case [Product].[Category].CurrentMember.Name
When [Product].[Category].&[1].Name Then "Bike"
Else "Others"
End
Select {[Measures].[Test],[Measures].[Internet Sales Amount]} on columns,
[Product].[Category].[Category].members on rows
from [Adventure Works]
Results
If you have any questions, please feel free to ask.
Regards,
Charlie Liao
TechNet Community Support -
Case statement Not working with Oracle version 10g
Below is code , which works on 11r2 but not on 10g.
declare
v1 VARCHAR2(200);
begin
select version into v1 from DBA_REGISTRY WHERE COMP_NAME LIKE '%Catalog Views%';
CASE
WHEN v1 like '10.2%' THEN
DBMS_OUTPUT.PUT_LINE('it is 10.2');
dbms_streams_auth.grant_admin_privilege('GGADMIN');
WHEN v1 like '11.1%' THEN
DBMS_OUTPUT.PUT_LINE('it is 11.1');
dbms_streams_auth.grant_admin_privilege('GGADMIN');
EXECUTE IMMEDIATE 'grant become user to GGADMIN';
WHEN v1 like '11.2.0.3%' THEN
DBMS_OUTPUT.PUT_LINE('it is 11.2.0.3');
dbms_goldengate_auth.grant_admin_privilege('GGADMIN');
END CASE;
end;
/I dont know when i run code in 10.2 it still looks for dbms_goldengate_auth
and error out.
dbms_goldengate_auth.grant_admin_privilege('GGADMIN');
ERROR at line 18:
ORA-06550: line 18, column 1:
PLS-00201: identifier 'DBMS_GOLDENGATE_AUTH.GRANT_ADMIN_PRIVILEGE' must be declared
ORA-06550: line 18, column 1:
PL/SQL: Statement ignoredif I comment dbms_goldengate_auth it returns perfect result.
it is 10.2
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.03Is there any other way around ????
Edited by: 949509 on Jan 27, 2013 6:57 PM949509 wrote:
Can you please tell me How i can execute dynamic sql via execute immediate.In a very simialr was as you did the grant of become user in your code. SOmething like:
declare
v1 VARCHAR2(200);
l_grant_str VARCHAR2(1000);
begin
select version into v1 from DBA_REGISTRY WHERE COMP_NAME LIKE '%Catalog Views%';
CASE
WHEN v1 like '10.2%' THEN
DBMS_OUTPUT.PUT_LINE('it is 10.2');
l_grant_str := 'dbms_streams_auth.grant_admin_privilege(''GGADMIN]'')';
WHEN v1 like '11.1%' THEN
DBMS_OUTPUT.PUT_LINE('it is 11.1');
l_grant_str := 'dbms_streams_auth.grant_admin_privilege(''GGADMIN'')';
EXECUTE IMMEDIATE 'grant become user to GGADMIN';
WHEN v1 like '11.2.0.3%' THEN
DBMS_OUTPUT.PUT_LINE('it is 11.2.0.3');
l_grant_str := 'dbms_goldengate_auth.grant_admin_privilege(''GGADMIN'')';
END CASE;
execute immediate l_grant_str;
end;John -
CLOB with case statement not working getting error
Can anyone help on this
I write this sql
select Case when to_clob(PROPERTY) = 'is_intradesk=Y' then 'Internal' end
from JPM_CP;
Where PROPERTY column is clob column and its giving the error "ORA-00932: inconsistent datatypes: expected - got CLOB"
Is it not possible to use clob columns with case or decode !Its working but it does not fulfill my purpose
In you answer it is looking for position right! means, does the column contain the value('Intradesk=Y' ) or not. means
I am looking for exact match with CLOB column values, that is Clob column(PROPERTY) contains the exact value that value which I am comparing with i.e 'Intradesk=Y'
I need this
select * from table where clob_column = 'value' (exact).
Edited by: sajalkdas on Feb 4, 2011 3:28 PM -
Case statement not working as expected
I get this error having the group by clause: ORA-00979: not a GROUP BY expression
I get this error with out it: ORA-00937: not a single-group group function
If I add sp.PUBLISHER_ID to the group by, my data comes out on separate lines like this:
BT jlloyd ALLEN IVERSON B 0 3 0
BT jlloyd ALLEN IVERSON B 1 0 0
What am I doing wrong?
select distinct office_id,user_id,
nvl(customer, profile_name),
nvl(account, profile_name),
profile_name,
profile_type,
case when sp.PUBLISHER_ID = 503
then count(distinct sp.instance_id)
else 0 end as MR_Reports ,
case when sp.PUBLISHER_ID = 501
then count(distinct sp.instance_id)
else 0 end as QV_Reports,
case when sp.PUBLISHER_ID = 3533
then count(distinct sp.instance_id)
else 0 end as BS_Reports
from vw_profile_info p join SOLD_PUBLISHERS sp
on p.profile_id = sp.profile_id
join SOLD_SEGMENTS ss
on ss.profile_id = sp.PROFILE_ID
and ss.instance_id = sp.instance_id
and ss.BASKET_ID = sp.basket_id
join publishers p
on p.publisher_id = sp.publisher_id
where sp.publisher_id in (501,503,3533)
and sp.PUBLISHED_DATE between to_date('10/01/2005','mm/dd/yyyy') and
to_date('10/31/2005','mm/dd/yyyy')
and profile_name = 'ALLEN IVERSON
group by office_id,user_id,
nvl(customer, profile_name),
nvl(account, profile_name),
profile_name,
profile_typeThere are couple of ways, one of them would be
select office_id,
user_id,
nvl(customer, profile_name),
nvl(account , profile_name),
profile_name,
profile_type,
sum(decode(sp.PUBLISHER_ID, 503, 1, 0) MR_Reports,
sum(decode(sp.PUBLISHER_ID, 501, 1, 0) QV_Reports,
sum(decode(sp.PUBLISHER_ID, 3533, 1, 0) BS_Reports
from vw_profile_info p join SOLD_PUBLISHERS sp
on p.profile_id = sp.profile_id
join SOLD_SEGMENTS ss
on ss.profile_id = sp.PROFILE_ID
and ss.instance_id = sp.instance_id
and ss.BASKET_ID = sp.basket_id
join publishers p
on p.publisher_id = sp.publisher_id
where sp.publisher_id in (501,503,3533)
and sp.PUBLISHED_DATE between to_date('10/01/2005','mm/dd/yyyy') and to_date('10/31/2005','mm/dd/yyyy')
and profile_name = 'ALLEN IVERSON'
group by office_id,
user_id,
nvl(customer, profile_name),
nvl(account , profile_name),
profile_name,
profile_type -
MDX -Children count function Not working in Case statement
Hi,
I am trying to create set when you slice with the Hierarchy member is leaf level , I want a output only that Leaf level .
and When I slice with the parent level , it has to give all the members below that parent level.
But the problem here is when I select child member or leaf member , The first condition in the Case is not working
WITH SET
TESTSET AS
CASE
WHEN
[Dimension].[Hierarchy].currentmember.children.count<0
THEN
[Dimension].[Hierarchy].currentmember
ELSE
DESCENDANTS([Dimension].[Hierarchy].Currentmember,,AFTER)
END
SELECT
WBSSET ON 1,
{} on 0
FROM
(SELECT {[Dimension].[Hierarchy].&[10]} ON COLUMNS FROM [CubeName])
Thanks,
SantoshHi Santosh,
I don't think Children count function not working in case statement, I have tested it on my local environment, here s the sample query for you reference.
with member
testset as
case
when
[Geography].[Geography].currentmember.children.count<10
then "X"
else "OK"
end
select testset on 0,
{[Geography].[Geography].[Country].members} on 1
from
[Adventure Works]
In your scenario, the issue might be caused by the query isself, you can try to use IsLeaf Funcion to achieve your requirement. Please refer to the links below.
http://msdn.microsoft.com/en-us/library/ms144932.aspx
http://www.databasejournal.com/features/mssql/article.php/3633696/MDX-Operators-The-IsLeaf-Operator--Conditional-Logic-within--Calculations.htm
http://www.mdxpert.com/Functions/MDXFunction.aspx?f=22
Regards,
Charlie Liao
TechNet Community Support -
Case when statement not working
hi there, I am trying to work out how to get my case statement to work.
I have got the following code.
select pthproto.pthdbo.cnarole.tpkcnarole, pthproto.pthdbo.cnaidta.formataddr as formataddr, cnaidta.dateeffect as maxdate, isnull(cast (pthproto.pthdbo.cnaaddr.prefix1key as varchar (50)),'') + ' ' + isnull(cast (pthproto.pthdbo.cnaaddr.prefix2key
as varchar (50)),'')+ ' ' + isnull(cast (pthproto.pthdbo.cnaaddr.prefix3key as varchar (50)),'') + ' ' + isnull (cast (pthproto.pthdbo.cnaaddr.houseidkey as varchar (100)),'') + ' ' + isnull (cast (pthproto.pthdbo.cnaaddr.component1
as varchar (100)),'') + ' ' + isnull (cast (pthproto.pthdbo.cnaaddr.component2 as varchar (100)),'') + ' ' + isnull (cast (pthproto.pthdbo.cnaaddr.component3 as varchar (100)),'') + ' ' + isnull (cast (pthproto.pthdbo.cnaaddr.component4
as varchar (100)),'') + ' ' + isnull (cast (pthproto.pthdbo.cnaaddr.component5 as varchar (100)),'') as mailaddress, row_number() over(partition by pthproto.pthdbo.cnarole.tpkcnarole order by cnaidta.dateeffect desc) as rn into #address from pthproto.pthdbo.cnarole
inner join pthproto.pthdbo.cnaidty on cnarole.tfkcnaidty =cnaidty.tpkcnaidty inner join pthproto.pthdbo.cnaidta on cnaidty.tpkcnaidty = cnaidta.tfkcnaidty inner join pthproto.pthdbo.cnaaddr on cnaidta.tfkcnaaddr = cnaaddr.tpkcnaaddr order by cnaidta.dateeffect
select *, case when mailaddress is not null then mailaddress else formataddr end as test from #address where tpkcnarole = '18306695'
The case when statement is struggling with how i have created the column mailaddress. As it does seem to understand when it is null. In the example I have got there is no value in any of the columns to create
the mailaddress. Hence why I am referencing it from elsewhere. Due to having a way on the system where it picks up data from 2 different places. The mailaddress is always correct if there is one, hence why
trying to reference that one first. So how do i change this case when statement to work ?It's ok I have fixed my own problem
when
(mailaddress
is
null
or mailaddress
=
then formataddr
else mailaddress
end
as test
case -
Case tatement not working within a cursor
I am having a problem getting the case statement to work within a cursor in a store procedure in our 2008 r2 environment. Below is the cursor that I'm referring too. Any suggestions would be greatly appreciated.
SET NOCOUNT ON;
DECLARE @part_id as int, @WAREHOUSE_ID AS varchar(80), @SAFETY_STOCK_QTY AS int;
DECLARE parts_cursor CURSOR FOR
select part_id ,WAREHOUSE_ID, coalesce(SAFETY_STOCK_QTY,0) from PART_WAREHOUSE where Part_ID in (SELECT distinct #FLINES03.Part from #FLINES03)
OPEN parts_cursor
FETCH NEXT FROM parts_cursor
INTO @part_id, @WAREHOUSE_ID, @SAFETY_STOCK_QTY
WHILE @@FETCH_STATUS = 0
BEGIN
CASE @WAREHOUSE_ID
WHEN 'AAA' THEN UPDATE #FLINES03 SET WHS1_SS_QTY = @SAFETY_STOCK_QTY WHERE #FLINES03.PART = @part_id AND #FLINES03.WHS1 = @WAREHOUSE_ID
WHEN 'BBB'THEN UPDATE #FLINES03 SET WHS2_SS_QTY = @SAFETY_STOCK_QTY WHERE #FLINES03.PART = @part_id AND #FLINES03.WHS2 = @WAREHOUSE_ID
WHEN 'CCC' THEN UPDATE #FLINES03 SET WHS3_SS_QTY = @SAFETY_STOCK_QTY WHERE #FLINES03.PART = @part_id AND #FLINES03.WHS3 = @WAREHOUSE_ID
END
FETCH NEXT FROM parts_cursor INTO @part_id, @WAREHOUSE_ID, @SAFETY_STOCK_QTY
END
CLOSE parts_cursor
DEALLOCATE parts_cursorCASE is an expression, not a statement. It means you can not execute code. You need to change your code to IF statements, e.g.
IF @WAREHOUSE_ID = 'AAA'
UPDATE ....
IF
UPDATE ...
Also, what is the purpose of using cursor? Can you provide the whole picture of what you're trying to achieve?
For every expert, there is an equal and opposite expert. - Becker's Law
My blog
My TechNet articles -
Simple short cuts not working in CC?
Does anyone know why simple commands are not working in Illustrator CC (Copy, Paste, Undo) This is such an irritating problem as these short cuts are so frequently used. My cloud software is up-to-date. Having upgraded my software I would prefer not to have us CS5 to combat this problem.
Hi Vaibhav,,
Thankx for the prompt help!!
I'm using Submit to SAP button only and I do have xACF installed on my local m/c. I'm able to use buttons and validations on the form but I'm not able to get the values in my WDynpro ABAP Appl. For Eg. : and internal table is bound to a table UI in adobe iForm , I'm able to add row (using formcalc/JScript eventing in Adobe) but I'm not able to get the changed internal table in my WDynpro ABAP application after submit button is pressed.
Any help will be highly appreciated.
Regds,
Aryan -
False/True Case is not working. Please Help!
Dear all,
I attached my block diagram, one attachment refers to true case and the other refers to false case.
My program runs like this: when i run the vi , after homing the motor (there is home.vi), DAQ is collecting the values in the while loop, and according to the DAQ's value, motor should run the False/True case but it does not
As a result: true/false case is not working which is located at the outside of the loop(bottom side of the block diagram)
When i put the the True/false inside the Loop(DAQ's loop) , then it is working. But this brings lots of problem, two of them is:
1-) When the DAQ values goes below to "50" then it turns to true case again,
2-) The false case has stop.vi which cause to motor stop every iteration of the loop.
So that is why i put True/False case out of the loop but now it is not working at all.
Please answer, waiting response.
Thank you,
Have a nice day,
Kind Regards.
Attachments:
OutloopTrueMode.pdf 432 KB
OutofLoopNotWorking.pdf 443 KBSalander wrote:
Dear GerdW,
Thank you for reply, You can see my answers written with red.
"As long as the case structure is located outside the loop it will not be called before the loop stops. THINK DATAFLOW!"
- The case structure need to run same time with the loop, because as you can see from the attachments the case structure is also integrated with DAQ values.. loop is continuous till i press the stop button. So what i understand that this case structure will not work because loop is continuous?? Cant we upgrade the vi. or do smthg that it can be able to work same time with the loop??
Kind Regards.
You have to place the case structure inside the while loop ( Any significance is there on placing the case outside the loop? ).
Salander wrote:
Dear GerdW,
Btw. it would be much more useful to attach real pictures or, even better, the VI...
Because most of the people dont have my "motor controller's labview drivers" I attached as a PDF file which is very popular.
Not Really * .png file ( vi snippet ) is much more popular here in Discussion Forum
The best solution is the one you find it by yourself -
hi to all,
I am trying to write use inner joining . here is code
DATA:tabname LIKE dd02L-tabname,
table_disc LIKE dd02t-ddtext.
SELECT dd02ltabname dd02tddtext INTO (tabname,table_disc)
FROM dd02l INNER JOIN dd02t on dd02ltabname = dd02ttabname
WHERE dd02tddlanguage = 'E' AND dd02ltabclass = 'TRANSP'
AND dd02L~tabname = 'ZANKI*'.
endselect.
write : tabname.
I also checked in tables dd02t and dd02l for the table zanki* and data available in both table . but here select statement not working .do u have any idea about this. thank youHi,
I executed the ur inner join conditin by commenting 'z*' it's working fine.
I think where condition is not getting satisfied so u r not getting any data.
Please conform in where condition you need * 'AND'* or OR
I change decalration as below.
DATA:tabname type TABNAME,
table_disc type AS4TEXT.
SELECT dd02l~tabname
dd02t~ddtext INTO (tabname, table_disc)
FROM dd02l INNER JOIN dd02t on dd02l~tabname = dd02t~tabname
WHERE dd02t~ddlanguage = 'E' AND
dd02l~tabclass = 'TRANSP'AND
dd02L~tabname = 'ZANKI*'.
endselect.
write : tabname.
Regards,
Pravin
Maybe you are looking for
-
How to determine the path of the jar file cache of javawebstart?
Hello, I need to know how to determine where the java web start application file jar cache is stored on windows system hard drive. I would have launch of the inner processes I have need to know the path of file jar . example if my application is myAp
-
I don't understand why I get sqlldr error
Hi, I am using sqlldr to load a ':' delimited text file into my db table. when I run sqlldr I see this error in the log... Record 56: Rejected - Error on table XYZ, column VARD. Field in data file exceeds maximum length ... yet the field VARD in the
-
ABAP program parallel processing
Dear team, (Not sure if I have opened this message at correct place) We have A program (forecasting that is related to Production planning). It runs country wise. We have it running for Country XYZ where there are many plants; the job runs without an
-
Hi All, These days my ESR in CE 7.1 cannot work properly, why I try to launch it entering the address http://<myhostname>:<java port>/rep, follow exceptions were throw out: Exception class: com.sap.aii.utilxi.prop.api.PropertiesException$InitFail
-
Error occurs when startup window 8.1
Hi! I'm su. I have a question for you about window 8.1 After I login my account by password, it displays "preparing window". I waited about 10 minutes. result: all program, icon on desktop are disappeared.I checked my user but i saw a user whose nam