0

i have on my report a field with inside this expression:

=First(Fields!namefield.Value, "namedataset")

namefield is a boolean data type and always return true or false

but when i want to change expression in

=Iif(First(Fields!namefield.Value, "namedataset"), "True option", "False option")

return #Error.

Why?

Edit for more details I tried follow expression

=Iif(1000>100, "True option", "False option")

and it works fine then problem is First(Fields!namefield.Value, "namedataset")

Massimo
  • 141
  • 1
  • 2
  • 13
  • 1
    Cannot reproduce you problem with VS2005. Are you actually using the expression you posted? Or the error could be raised by IIf TruePart/FalsePart? – tezzo Oct 23 '13 at 08:43
  • Also works in VS2008. Are you *sure* `nameField` is being seen as a boolean? Does `=CBool(First(Fields!namefield.Value, "namedataset"))` work? `=Iif(CBool(First(Fields!namefield.Value, "namedataset")), "True option", "False option")`? – Ian Preston Oct 23 '13 at 08:46
  • thanks for your reply, im using VS2010, namefield comes from Dataset by a boolean field im sure, btw every try to convert with cbool gives an error – Massimo Oct 23 '13 at 08:51
  • Verify field type in your report. If you don't find Report Data window: http://stackoverflow.com/questions/8404297/why-cant-i-see-the-report-data-window-when-creating-reports – tezzo Oct 23 '13 at 09:10
  • hello, how can verify field type with that window? there is not property window – Massimo Oct 23 '13 at 09:22
  • ok found it is a boolean data type – Massimo Oct 23 '13 at 09:24
  • So it's another problem. Is "nameddataset" defined in the object that you are using (i.e. Tablix)? What happened if you simply use First(Fields!namefield.Value)? – tezzo Oct 23 '13 at 09:28
  • if i simply use First(Fields!namefield.Value) will return true or false – Massimo Oct 23 '13 at 09:33
  • Are you using a Tablix? It seems that "nameddataset" is not defined in the object you are using (or at a report level). Very strange that the first expression you posted works: are you simply modified the expression to use IIf or create another field in a different position of report? – tezzo Oct 23 '13 at 09:45
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/39809/discussion-between-massimo-and-tezzo) – Massimo Oct 23 '13 at 09:49

0 Answers0