April 9, 2008 at 7:37 pm
Hi
I have an expression that I put together:
=IIF
(
Fields!Item_id.Value
in (1,5,6,7,8,9,10,12,13,14,16,20,32,36,37,38,39,40), 1, 0
)
when I try to preview my report I get the following message:
The value expression for the textbox ‘textbox7’ contains an error: [BC30456] 'Valuein' is not a member of 'Microsoft.ReportingServices.ReportProcessing.ReportObjectModel.Field'.
Can someone tell me how I should be writing this statement.
Any help would be appreciated.
Cheers
Tracy
April 10, 2008 at 7:16 am
Try the InStr function. It returns an integer specifying the start position of the first occurrence of one string within another.
Rephrasing your example, this is the syntax:
=IIF(InStr("1,5,6,7,8,9,10,12,13,14,16,20,32,36,37,38,39,40", Fields!Item_id.Value) > 0, 1, 0)
If your Item_id is a numeric field you may need to convert it to a string with CStr().
=IIF(InStr("1,5,6,7,8,9,10,12,13,14,16,20,32,36,37,38,39,40", CStr(Fields!Item_id.Value)) > 0, 1, 0)
HTH
[font="Comic Sans MS"]toolman[/font]
[font="Arial Narrow"]Numbers 6:24-26[/font]
April 10, 2008 at 3:35 pm
Tracy Avis (4/9/2008)
HiI have an expression that I put together:
=IIF
(
Fields!Item_id.Value
in (1,5,6,7,8,9,10,12,13,14,16,20,32,36,37,38,39,40), 1, 0
)
when I try to preview my report I get the following message:
The value expression for the textbox ‘textbox7’ contains an error: [BC30456] 'Valuein' is not a member of 'Microsoft.ReportingServices.ReportProcessing.ReportObjectModel.Field'.
You're mixing SQL and VB syntax. If you use the INSTR() suggestion, you'll need to put commas around the list and around the value to avoid false matches. But I find it easier to just add some things like that to the query.
select item_id, ...
from ... where ...
--- becomes
select item_id, (case when item_id in (...) then 1 else 0 end) as item_is_special, ...
from ... where ...
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply