SSRS IIF Statement #Error
All,
I have the below IIF statement in SSRS report based on a sharepoint list. However I get #Error only on certain lines
For example when Item_Name = P001-P384D630Z01
I am sort of stunned at this point. All the other lines work except the one with above item name. If I remove the MF5 Mod Center part of the iif then everything works.
=
Iif((mid(Fields!Item_Name.Value,8,1)= 3 OR mid(Fields!Item_Name.Value),8,1)=4) AND LEFT(TRIM(Fields!Project_No.Value),1) =8, "MF5 Mod Center",
Iif(Left(Fields!Project_No.Value,1)="3","HOU MOD",
Iif(Left(Fields!Item_Name.Value,3) = "RDC","RDC",
Iif(Left(Fields!Item_Name.Value,4) = "P001","Overseas",
Iif(IsNothing(Fields!Engineering_Status.Value), "Pre-engineering",
Iif(Fields!Engineering_Status.Value="P.C. Finished", "Production",
Fields!Engineering_Status.Value
It's working after removing the "-" in the item_name if anyone is wondering.
=
Iif(Left(Fields!Project_No.Value,1)="3","HOU MOD",
Iif(Left(Fields!Item_Name.Value,3) = "RDC","RDC",
Iif(Left(Fields!Item_Name.Value,4) = "P001","Overseas",
Iif(IsNothing(Fields!Engineering_Status.Value), "Pre-engineering",
Iif(Fields!Engineering_Status.Value="P.C. Finished", "Production",
Iif((mid(replace(Fields!Item_Name.Value,"-",""),8,1)= 3 OR mid(replace(Fields!Item_Name.Value,"-",""),8,1)=4) AND LEFT(TRIM(Fields!Project_No.Value),1) =8, "MF5 Mod Center"
,Fields!Engineering_Status.Value
Similar Messages
-
I have an expression in my SSRS report that calculates a field Total across multiple groups:
=IIf(SUM(Fields!sales_Dollars.Value) > 0 ,(SUM(Fields!Total_Defective__.Value)/IIF(SUM(Fields!sales_Dollars.Value) <= 0, 1, SUM(Fields!sales_Dollars.Value))),0)
I had to alter it by adding groups within the statement:
=SUM(IIf(SUM(Fields!sales_Dollars.Value,"Item_Process_Group") > 0 ,(SUM(Fields!Total_Defective__.Value,"Item_Process_Group")/IIF(SUM(Fields!sales_Dollars.Value,"Item_Process_Group") <= 0, 1, SUM(Fields!sales_Dollars.Value,"Item_Process_Group"))),0))
The problem is that there is a 0 in the denominator of one of the rows in the calc that is not in the group specified in the clause. This causes an #error. (at least I believe this is the cause)
is there a way to slip in a check for zero in **Fields!sales_Dollars.Value** with no group? sort of like how it does it in the first code example.
I need the group names in the bottom portion to pull the correct values.Hi,
I have tested with your sample data, its working fine for me with your expression as shown in the below screen.
you can see my sample RDL.
<?xml version="1.0" encoding="utf-8"?>
<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
<Body>
<ReportItems>
<Tablix Name="table1">
<TablixBody>
<TablixColumns>
<TablixColumn>
<Width>1in</Width>
</TablixColumn>
<TablixColumn>
<Width>1in</Width>
</TablixColumn>
<TablixColumn>
<Width>1in</Width>
</TablixColumn>
<TablixColumn>
<Width>1in</Width>
</TablixColumn>
</TablixColumns>
<TablixRows>
<TablixRow>
<Height>0.22in</Height>
<TablixCells>
<TablixCell>
<CellContents>
<Textbox Name="textbox2">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>Process</Value>
<Style>
<FontFamily>Tahoma</FontFamily>
<FontSize>11pt</FontSize>
<FontWeight>Bold</FontWeight>
<Color>White</Color>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>textbox2</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<BackgroundColor>SteelBlue</BackgroundColor>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="textbox3">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>Total Defective </Value>
<Style>
<FontFamily>Tahoma</FontFamily>
<FontSize>11pt</FontSize>
<FontWeight>Bold</FontWeight>
<Color>White</Color>
</Style>
</TextRun>
</TextRuns>
<Style>
<TextAlign>Right</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<rd:DefaultName>textbox3</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<BackgroundColor>SteelBlue</BackgroundColor>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="textbox4">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>sales Dollars</Value>
<Style>
<FontFamily>Tahoma</FontFamily>
<FontSize>11pt</FontSize>
<FontWeight>Bold</FontWeight>
<Color>White</Color>
</Style>
</TextRun>
</TextRuns>
<Style>
<TextAlign>Right</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<rd:DefaultName>textbox4</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<BackgroundColor>SteelBlue</BackgroundColor>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="Textbox5">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>COQ</Value>
<Style>
<FontFamily>Tahoma</FontFamily>
<FontSize>11pt</FontSize>
<FontWeight>Bold</FontWeight>
<Color>White</Color>
</Style>
</TextRun>
</TextRuns>
<Style>
<TextAlign>Right</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox5</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<BackgroundColor>SteelBlue</BackgroundColor>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
</TablixCells>
</TablixRow>
<TablixRow>
<Height>0.21in</Height>
<TablixCells>
<TablixCell>
<CellContents>
<Textbox Name="Process">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Fields!Process.Value</Value>
<Style>
<FontFamily>Tahoma</FontFamily>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Process</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="Total_Defective__">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Fields!Total_Defective__.Value</Value>
<Style>
<FontFamily>Tahoma</FontFamily>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Total_Defective__</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="sales_Dollars">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Fields!sales_Dollars.Value</Value>
<Style>
<FontFamily>Tahoma</FontFamily>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>sales_Dollars</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="Textbox6">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=iif( Fields!Total_Defective__.Value>0, Fields!Total_Defective__.Value/Fields!sales_Dollars.Value,0)</Value>
<Style>
<FontFamily>Tahoma</FontFamily>
<Format>0.00;(0.00)</Format>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox6</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
</TablixCells>
</TablixRow>
<TablixRow>
<Height>0.25in</Height>
<TablixCells>
<TablixCell>
<CellContents>
<Textbox Name="Textbox26">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value />
<Style>
<FontFamily>Tahoma</FontFamily>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox26</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="Total_Defective__1">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Sum(Fields!Total_Defective__.Value)</Value>
<Style>
<FontFamily>Tahoma</FontFamily>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Total_Defective__1</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="sales_Dollars1">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Sum(Fields!sales_Dollars.Value)</Value>
<Style>
<FontFamily>Tahoma</FontFamily>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>sales_Dollars1</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="Textbox29">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=SUM(IIf(SUM(Fields!sales_Dollars.Value,"Item_Process_Group") > 0 ,(SUM(Fields!Total_Defective__.Value,"Item_Process_Group")/IIF(SUM(Fields!sales_Dollars.Value,"Item_Process_Group") <= 0, 1, SUM(Fields!sales_Dollars.Value,"Item_Process_Group"))),0))</Value>
<Style>
<FontFamily>Tahoma</FontFamily>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox29</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
</TablixCells>
</TablixRow>
</TablixRows>
</TablixBody>
<TablixColumnHierarchy>
<TablixMembers>
<TablixMember />
<TablixMember />
<TablixMember />
<TablixMember />
</TablixMembers>
</TablixColumnHierarchy>
<TablixRowHierarchy>
<TablixMembers>
<TablixMember>
<KeepTogether>true</KeepTogether>
</TablixMember>
<TablixMember>
<Group Name="Item_Process_Group">
<GroupExpressions>
<GroupExpression>=Fields!Process.Value</GroupExpression>
</GroupExpressions>
</Group>
<SortExpressions>
<SortExpression>
<Value>=Fields!Process.Value</Value>
</SortExpression>
</SortExpressions>
<TablixMembers>
<TablixMember>
<Group Name="table1_Details_Group">
<DataElementName>Detail</DataElementName>
</Group>
<TablixMembers>
<TablixMember />
</TablixMembers>
<DataElementName>Detail_Collection</DataElementName>
<DataElementOutput>Output</DataElementOutput>
<KeepTogether>true</KeepTogether>
</TablixMember>
<TablixMember>
<KeepWithGroup>Before</KeepWithGroup>
</TablixMember>
</TablixMembers>
</TablixMember>
</TablixMembers>
</TablixRowHierarchy>
<DataSetName>DataSet1</DataSetName>
<Top>0.37in</Top>
<Height>0.68in</Height>
<Width>4in</Width>
<Style />
</Tablix>
<Textbox Name="textbox1">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>IIF</Value>
<Style>
<FontFamily>Tahoma</FontFamily>
<FontSize>16pt</FontSize>
<FontWeight>Bold</FontWeight>
<Color>SteelBlue</Color>
</Style>
</TextRun>
</TextRuns>
<Style>
<TextAlign>Center</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<rd:DefaultName>textbox1</rd:DefaultName>
<Height>0.37in</Height>
<Width>5in</Width>
<ZIndex>1</ZIndex>
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</ReportItems>
<Height>1.3in</Height>
<Style />
</Body>
<Width>5in</Width>
<Page>
<LeftMargin>1in</LeftMargin>
<RightMargin>1in</RightMargin>
<TopMargin>1in</TopMargin>
<BottomMargin>1in</BottomMargin>
<Style />
</Page>
<AutoRefresh>0</AutoRefresh>
<DataSources>
<DataSource Name="DataSource1">
<DataSourceReference>DataSource1</DataSourceReference>
<rd:SecurityType>None</rd:SecurityType>
<rd:DataSourceID>0404c681-a734-438b-8708-447809487513</rd:DataSourceID>
</DataSource>
</DataSources>
<DataSets>
<DataSet Name="DataSet1">
<Query>
<DataSourceName>DataSource1</DataSourceName>
<CommandText>select *
from sales</CommandText>
<rd:UseGenericDesigner>true</rd:UseGenericDesigner>
</Query>
<Fields>
<Field Name="Process">
<DataField>Process</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="Total_Defective__">
<DataField>Total_Defective__</DataField>
<rd:TypeName>System.Decimal</rd:TypeName>
</Field>
<Field Name="sales_Dollars">
<DataField>sales_Dollars</DataField>
<rd:TypeName>System.Decimal</rd:TypeName>
</Field>
</Fields>
</DataSet>
</DataSets>
<Language>en-US</Language>
<ConsumeContainerWhitespace>true</ConsumeContainerWhitespace>
<rd:ReportUnitType>Inch</rd:ReportUnitType>
<rd:ReportID>4435f425-143e-441c-b41a-7c5407db2b37</rd:ReportID>
</Report>
Run the RDL by create sample table and data as shown below:-
create table Sales(Process Varchar(50),Total_Defective__ numeric (10,2),sales_Dollars numeric(10,2))
insert into Sales values
('abc',0,2423.74)
,('abc',0,1184.64)
,('abc',15.02,569.72)
,('abc',26.79,0)
,('abc',4.05,22894.08)
,('abc',0,3333.63)
,('abc',18.42,372.60)
,('abc',0,465.35)
,('abc',0,1521.16)
,('abc',512.44,99142.67)
,('abc',6010.07,245804.00)
,('abc',81.79,9607.20)
,('abc',00.00,34597.74)
,('abc',00.00,27592.20)
,('abc',2187.23,40543.52)
,('abc',251.71,58263.60)
,('abc',44.32,45551.34)
You edit my RDL and try to stimulate your issue and send it to me.. my RDL is in 2012.
Thanks
Prasad -
SSRS - IFF statement error in Oracle dataset query
I am getting the error:
Query Definitions Differ
The following errors were encountered while parsing the contents of the SQL pane:
Error in list of function arguments: '=' not recognized.
Unable to parse query text.
The statement it is erring on is:
IFF("T$RERR"=1,'No','Yes') AS RuntimeError
Is it because I have "" around the field name?
Fred SchmidI don't think SSRS likes the IFF statement. I switched to using the DECODE statement and it works fine.
DECODE("T$RERR", 1, "Yes", 2, "No") AS RuntimeError
(I had the Yes and No backwards in the above the IFF statement).
I first tried the CASE statement and that didn't work so I tried the IFF.
Fred Schmid -
Writing an IIF Statement in SSRS using IN or LIKE
Hello,
I am trying to write an IIf statement with multiple conditions and I am getting an error. Here is the current syntax:
=IIf(Fields!role_sk.Value=4174 AND Fields!settle_type_sk.Value
LIKE (4159,4160), Fields!company_name.Value,"")
Here is the error:
Any ideas? I think it has to do with the LIKE.
ThankThe syntax on the Like is incorrect. The Like operator expects a string to compare to that uses an * as a wildcard for any character(s).
=IIf(Fields!Name.Value Like "F*", Fields!Name.Value, "Not F")
This will display the name field if it starts with an "F" or "Not F" if not.
The "In" operator is not available in expression builder but is available in filters (Tablix, Group, etc.). To use that, the Value must be an array. You can create
an array of static text using the Split function in expression builder.
=Split("Me,You,Them",",")
This creates an array with 3 elements:Me, You, and Them. If any are matched in the field or expression you are comparing to in the filter, the record will be displayed,
otherwise not.
"You will find a fortune, though it will not be the one you seek." -
Blind Seer, O Brother Where Art Thou
Please Mark posts as answers or helpful so that others may find the fortune they seek. -
Multiple IIF Statements in SSRS Expression
Team:
The following IIF expression works:
=IIf(Fields!Court.Value = "MA", "Total Filed: Daily = "&Fields!MAFiledDaily.Value, Nothing)&
IIf(Fields!Court.Value = "MA", " | Monthly = "&Fields!MAFiledTotal.Value, Nothing)
However; I have 10 additional Court.Values for the IIF statement to check and return results.
I have tried the following with no luck ("OR" added):
=IIf(Fields!Court.Value = "MA", "Total Filed: Daily = "&Fields!MAFiledDaily.Value, Nothing)&
IIf(Fields!Court.Value = "MA", " | Monthly = "&Fields!MAFiledTotal.Value, Nothing)
or
IIf(Fields!Court.Value = "MB", "Total Filed: Daily = "&Fields!MBFiledDaily.Value, Nothing)&
IIf(Fields!Court.Value = "MB", " | Monthly = "&Fields!MBFiledTotal.Value, Nothing)
Any help would be welcomed.
Regards,
jer
jerYou have to nest the IIf statements which looks a bit messy but the only other way would be to alter your dataset to return the extra text you need with a case statement.
=IIf(Fields!Court.Value =
"MA",
"Total Filed: Daily = "&Fields!MAFiledDaily.Value, IIf(Fields!Court.Value =
"MB",
"Total Filed: Daily = "&Fields!MBFiledDaily.Value,
Nothing))&
IIf(Fields!Court.Value =
"MA",
" | Monthly = "&Fields!MAFiledTotal.Value, IIf(Fields!Court.Value =
"MB",
" | Monthly = "&Fields!MBFiledTotal.Value,
Nothing)) -
I have a question whether I am using the correct IIf statement in SSRS?
I have created a report with columns for case name, date opened, staff assigned, title, contact date, created by, and comments. I also have selected the comment_type field for the sake of indicating which data to pull but it will not be listed on the report.
I have the following IIf statement which indicates that if the comment_type is NOT equal to 4322 then I want it to return NOTHING (or a blank line, one line ONLY, not repeated ugh) and if it IS equal to 4322 then that's the information I want to be placed
on the report for created by, contact date, and comment fields.
=IIf(Fields!comment_type_sk.Value <> 4322, Nothing, 4322)
Now, the problem is, I want the report to generate as below and I'm not sure where to place this in order for it to render correctly. If the comment type 4322 is present then print the information in the last three columns, if it is anything but that,
then just a blank line where those fields are. The report itself is to be pulled on dated opened. SO...I'm not sure if this code should go under a parameter? or if it should just be stated in the expression for each of those fields? PS I am teaching myself
SQL. Sorry for the lack of knowledge.
Smith, Joe 1/1/2007
Jones, Tom Lead Atty 1/28/2013 MJohnson Set up meeting
Franz, Joseph 3/15/2008
Grouch, Oscar Lead Atty
Jones, Paula 2/16/2013
French, Mary Partner 2/20/2013 DFalk Atty Introduction
Thanks,
DawnHi,
You can place the IIF statement in the 3 columns. You do not need a parameter.But the iif statement in the last 3 columns should be similar as below
Col1 - iif(Fields!comment_type_sk.Value <> 4322,
Nothing,col1)
Col2 - iif(Fields!comment_type_sk.Value <> 4322,
Nothing,col2)
Col3 - iif(Fields!comment_type_sk.Value <> 4322,
Nothing,col3)
HTH,
Ram
Please vote as helpful or mark as answer, if it helps -
TABLE ILLEGAL STATEMENT error with MODIFY command
Hi gurus,
i want you to inform me about table illegal statement error. The error occurs when i use modify as below.
loop at itab.
select .......
where xxx eq itab-xxxx.
MODIFY itab.
endselect.
endloop.
i know that i have to give the sy-tabix as INDEX parameter to the modify command. but i want to know why i have to do this?
cause when i debug, i follow the sy-tabix field and it have not a change in select endselect.
may the reason of the error about cursor in select and cursor effects modify command?
or why?
Thx,Hello,
I guess this is because your MODIFY statement is inside the SELECT ... ENDSELECT & not inside the LOOP ... ENDLOOP.
SAP documentation says:
Within a LOOP loop, the INDEX addition can be ommitted. In this case the current table line of the LOOP loop is changed.
You have to change the coding:
DATA: v_index TYPE i.
loop at itab.
v_index = sy-index.
select .......
where xxx eq itab-xxxx.
MODIFY itab INDEX v_index.
endselect.
endloop.
BR,
Suhas
PS: The coding practice followed is not very performance oriented as well. May be you should have a look around in some blogs, wikis in SCN & change the code accordingly.
Edited by: Suhas Saha on Nov 19, 2009 9:41 AM -
I am getting "ORA-00900: invalid SQL statement" error.?
I did installed oracle 11gR2. and used "DBMS_METADATA_DIFF.COMPARE_ALTER('TABLE','TBL_A','TBL_A','USER1','USER2')" to see the result like below, but I am getting "ORA-00900: invalid SQL statement" error. Any idea?
I am using:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for 32-bit Windows: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
SQL> desc user1.tbl_a
Name Null? Type
FIELD_A1 NOT NULL NUMBER
FIELD_A2 VARCHAR2(20)
FIELD_A4 NOT NULL NUMBER(5,2)
FIELD_A5 VARCHAR2(10)
FIELD_A6 NOT NULL NUMBER(2)
SQL> desc user2.tbl_a
Name Null? Type
FIELD_A1 NOT NULL NUMBER
FIELD_A2 VARCHAR2(50)
FIELD_A3 DATE
FIELD_A4 NUMBER(5,2)
FIELD_A5 NOT NULL VARCHAR2(10)
SQL> select dbms_metadata_diff.compare_alter('TABLE','TBL_A','TBL_A','USER1','USER2') from dual
expected result:
DBMS_METADATA_DIFF.COMPARE_ALTER('TABLE','TBL_A','TBL_A','U1','U2')
ALTER TABLE "U1"."TBL_A" ADD ("FIELD_A3" DATE)
ALTER TABLE "U1"."TBL_A" DROP ("FIELD_A6")
ALTER TABLE "U1"."TBL_A" MODIFY ("FIELD_A2" VARCHAR2(50))
ALTER TABLE "U1"."TBL_A" MODIFY ("FIELD_A4" NUMBER(5,2) DEFAULT 0)
ALTER TABLE "U1"."TBL_A" MODIFY ("FIELD_A4" NULL)
ALTER TABLE "U1"."TBL_A" MODIFY ("FIELD_A5" NOT NULL ENABLE)Thanks for reply rp,
I got result using "select dbms_metadata_diff.compare_alter('TABLE','TBL_A','TBL_A','USER1','USER2') from dual" -
ORA-00900: invalid SQL statement Error while Executing Procedure
Hi:
I am trying to execute following procedure through java code, but i am getting ORA-00900: invalid SQL statement error.
Procedure is :
<code>
(vResult out int)
as
vCardId varchar2(16);
vForacid varchar2(16);
vApp_Entry_No varchar2(10);
vSrNo number(6);
vCardStatus char(1);
vCardStat char(2);
vExpiryDate date;
Cursor cardCur1 is
select u.card_number,trim(u.ACCOUNT_NUMBER),u.CARD_STATUS,to_char(u.EXPIRY_DATE,'dd-MM-yyyy')
FROM DailyCardData u
where default_indicator='1'
and isprocessed = 'N'
order by expiry_date;
begin
vSrNo := 0;
vResult := 0;
open cardCur1;
Loop
fetch cardCur1 into vCardId,vForacid,vCardStat,vExpiryDate;
if cardCur1%NOTFOUND then
exit;
end if;
if (vCardStat != null) then
vCardStatus := 'H';
elsif (vExpiryDate <= sysdate) then
vCardStatus := 'E';
else
vCardStatus := null;
end if;
select a.app_entry_no into vApp_Entry_No from Application a,ApplicationLinkedAccounts l
where l.foracid = vForacid and l.AcSrNo = '1'
and a.app_entry_no = l.app_entry_no
and a.cardid is null
and a.DOWNLOADFILECREATIONFLAG = 'Y';
update Application set CardId = vCardId,
Card_Status = vCardStatus,APPLICATIONPROCESSEDFLAG = 'Y',
APPLICATIONPROCESSEDdate = DOWNLOADFILECREATIONdate
where App_Entry_No = vApp_Entry_No;
commit;
update DailyCardData set isprocessed = 'Y',app_entry_no = vApp_Entry_No
where card_number = vCardId;
commit;
end Loop;
close cardCur1;
vResult := 1;
end;
</code>
Can any body help me in that?
Thank You,
AnupFirst of all I don't see a procedure header.
Secondly I see you commit inside your procedure. This is a bug.
Thirdly I see you also commit inside a loop. This is also a bug, and needs to be removed asap.
The error indicates a statement doesn't parse. As you don't post the error stack, nor a table definition no one can reproduce the problem.
You need to isolate the statements, one by one, and run them through sql*plus to see what happens.
Sybrand Bakker
Senior Oracle DBA -
Can we write an IIF statement in Designer??
Hi dears,
Can we write an IIF statement in Designer when we connect to the SAP BI 7.0 InfoCube?
I try to add a new dimension object to my universe design by using IIF statement.
At the below you can find my simple IIF statement.
<EXPRESSION>IIF([0FISCPER3].[LEVEL01].[[40FISCPER3]].[Value]='January',1,0)</EXPRESSION>
Is there anything wrong with syntax or smt??
my Business Objects env is BOXI 3.2
thanks a lot,
OmerHi,
this one includes samples:
https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/c0a45246-ce76-2b10-e688-f5c8206203eb
Ingo -
Invalid cursor state error while executing the prepared statement
hai friends,
following code showing the invalid cursor state error while executing the second prepared statement.
pls anyone help me
String query = "select * from order_particulars where order_no=" + orderno + " order by sno"; psmt1 = conEntry.prepareStatement(query, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); rs1 = psmt1.executeQuery(); rs1.last(); intRowCount = rs1.getRow(); particularsdata = new Object[intRowCount][6]; rs1.beforeFirst(); if (intRowCount >= 1) { for (int i = 0; rs1.next(); i++) { particularsdata[0] = i + 1;
particularsdata[i][1] = rs1.getString(3);
particularsdata[i][2] = Double.parseDouble(rs1.getString(4));
rs1.close();
psmt1.close();
query = "SELECT sum(delqty) FROM billdetails,billparticulars WHERE order_no= " + orderno + " and " +
"billdetails.bill_no = billparticulars.bill_no GROUP BY particulars ORDER BY sno";
psmt1 = conEntry.prepareStatement(query, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
rs1 = psmt1.executeQuery(); //error showing while executing this lineAlso .. Why using arrays instead of collections? Shifting the cursor all the way forth and back to get the count is fairly terrible.
With regard to the problem: either there's a nasty bug in the JDBC driver used, or you actually aren't running the compiled class version of the posted code. -
Using UNUSABLE on Unique Index gives "initially in unusable state" error
I am doing the following:
1. Truncate table
2 Alter PK Index Disable
2. Alter Unique Index Unusable
3. Insert /*+ APPEND NOLOGGING*/ into my table
My problem is, I get an "ORA-26026: unique index ... initially in unusable state" error when I try to do the Insert. If I make the Unique index non-unique it isn't a problem. If I drop the index and recreate it its not a problem - so uniqueness doesn't appear to be the issue. Can you not use UNUSABLE with a Unique index, I couldn't find any reference to this in the 10g docs.
I am using 10.1.0.4.
Thanks
Richard26026, 0000, "unique index %s.%s initially in unusable state"
//* Cause: A unique index is in IU state (a unique index cannot have
//* index maintenance skipped via SKIP_UNUSABLE_INDEXES).
//* Action: Either rebuild the index or index partition, or use
//* SKIP_INDEX_MAINTENANCE if the client is SQL*Loader. -
Writing IIF Statements for Sales Reps Goals
I have a query that takes all of the Sales Reps Goals and divides them into daily goals based on Potential sales days. This works perfectly when a rep starts before the beginning of the year. The issue I have is when a rep starts mid-year. If a rep starts
in June the goal should be divided by the remaining sales days left in the year and not the full year. I want to write an IIF statement that says if the rep's hire date is greater than 1/1/2015 then calculate based on remaining sales days. The query that works
for old reps is below:
SELECT uSERS.lifeguard_id
, GOALS.ProductID
, GOALS.GoalAmount / (SELECT SUM(WC.[Total Potential Sales Days (excluding Sat)])
FROM MISC.WorkingCalendar WC
WHERE WC.Year = YEAR(GETDATE())
GROUP BY [YEAR]
) * WC.[Total Potential Sales Days (excluding Sat)] AS GOALS
, WC.Month
, WC.Year
, DATEADD(DD,-1, DATEADD(MM,1,cast( (cast(WC.Month as varchar) + ' 1 , ' + cast(WC.Year as varchar)) as date))) AS GoalDatea
,CASE WHEN WC.Month= 'Jan' THEN '201501'
WHEN WC.Month = 'Feb' THEN '201502'
WHEN WC.Month = 'Mar' THEN '201503'
WHEN WC.Month = 'Apr' THEN '201504'
WHEN WC.Month = 'May' THEN '201505'
WHEN WC.Month = 'Jun' THEN '201506'
WHEN WC.Month = 'Jul' THEN '201507'
WHEN WC.Month = 'Aug' THEN '201508'
WHEN WC.Month = 'Sep' THEN '201509'
WHEN WC.Month = 'Oct' THEN '201510'
WHEN WC.Month = 'Nov' THEN '201511'
WHEN WC.Month = 'Dec' THEN '201512'
END AS YearMonth
FROM (
SELECT [CRM Rep Name] as CRMREPNAME
, CASE GoalAmount.GoalType
WHEN 'Yearly Life' Then 'L'
WHEN 'Yearly DI' then 'DI'
WHEN 'Yearly CI' then 'CI'
WHEN 'Yearly AI' then 'AC'
end as ProductID
, GoalAmount.GoalAmount
, YEAR(GETDATE()) AS GoalYear
FROM BAMaster.SalesRep SalesRep
unpivot (
GoalAmount FOR GoalType in([Yearly Life],[Yearly DI], [Yearly CI], [Yearly AI])) AS GoalAmount
) GOALS
JOIN VISION.Users Users
ON GOALS.CRMREPNAME = Users.user_code
JOIN MISC.WorkingCalendar WC
ON WC.Year = goals.GoalYear
where lifeguard_id is not null
order by lifeguard_idSales Days
Year
Month
Weekdays
Saturdays
Holidays
Total Potential Sales Days (including Sat)
Total Potential Sales Days (excluding Sat)
2014 Running Total
2015
Jan
20
5
2
25
20
20
2015
Feb
19
4
1
23
19
39
2015
Mar
22
4
0
26
22
61
2015
Apr
22
4
0
26
22
83
2015
May
20
5
1
25
20
103
2015
Jun
22
4
0
26
22
125
2015
Jul
22
3
1
25
22
147
2015
Aug
21
5
0
26
21
168
2015
Sep
21
4
1
25
21
189
2015
Oct
21
5
1
26
21
210
2015
Nov
18
4
3
22
18
228
2015
Dec
20
3
3
23
20
248
Grand Total
248
50
13
298
248
These are the sales days. A rep's hire date could be any date in 2015. -
Receiver JMS ( websphere MQ ) error - No transition found from state:ERROR
Hi all
we are using JMS adapter to connect to the Queue manager . whenever the queue manager restarts , the messages is not getting thru and it is struck in the adapter engine with status " not to be delivered "
i am getting error in receiver communication channel audit log....its showing
*MP: Exception caught with cause com.sap.aii.af.ra.ms.api.RecoverableException: No transition found from state: ERROR, on event: process_commence for DFA: CC_JMS_XXXXXXXXX:15fa03eb9fd837849906f512610314c4*
note : already i have gone thur many forum and nothing helps.
Thanks in advance
FaheemIf you are using the FCC then this could be because of that. What is the connection status with MQ? Are there any connection errors with MQ.
If you are using FCC in your Receiver JMS channel then just to confirm, first remove the FCC configuration and try to send a xml file. If the xml file goes in successfully then the problem is in your FCC configuration. -
Seeburger AS2 resent of files in state "Error on send, will be retried"
Hi,
I have a few AS2 files in state "Error on send, will be retried" in the Seeburger AS2 monitor, which does not seem to be sent.
How can I trigger the files to be sent again or delete so we can resent the files from the backend.
Daniel Graversen
[Figaf|http://figaf.com]Hi,
we have some messages in this status but none of them is displayed in the recovery monitor..
Any other idea?
Thank you,
Peter
Maybe you are looking for
-
I am trying to find an standard report which gives me information on the Work Orders and related Purchase Orders. Anything available or I will need to create one on my own? Cheers!
-
Nooooooo (Nomad Zen Xtra 30GB Emerge
Right, I tend to be a little clumsy, and have dropped my Zen before, nothing ever happened until a week or so ago when it bumped itself on the head and wiped the memory. I managed to reboot, and all was well again, but for the fact although there wer
-
Detecting message part after Recordsets per Message
Hi ! Scenario: File -> XI -> RFC Because of some big text files (about 30 or 40 mb) as input files, we need to use partition our files using Recordsets Per Message in the content conversion parameters of our file adapter (sender). We need to send to
-
Quick Mask Bug found (Mac OS 10.6.8)
Hello there! I found a bug using the quick mask while editing a layer mask. Example: You have a document with a layer that has a pixel mask. Then you alt-click the layer mask to display it in black and white, to be able to paint on it for example. If
-
okay heres the script i currently have set theWiFi to do shell script "wifi=`system_profiler SPAirPortDataType|awk -F\": \" '/Current Wireless Network/{print \"\\ \"$2}'` ifconfig | awk '/flags=|media|inet / {if (substr($2, 1, 6) == \"flags=\") print