Jorgen V
Jorgen V

Reputation: 313

Iif function in SQL Server Report Builder 2012

=IIf((First(Fields!CustomerCountry.Value, "Invoice"))<>(First(Fields!SupplierCountry.Value, "Invoice"))),0,((Sum(Fields!SellingPrice.Value, "Invoice")*(Parameters!BTW.Value)))

I'm making an automatic invoice in Microsoft SQL Server Report Builder but I'm stuck on the VAT (BTW-parameter in this example). If a customer is not from the same country as the supplier, he shouldn't pay VAT. If he is, he should pay VAT. I'm thinking i'm missing a parenthese (or having too much of 'em). I'm quite new to SQL so I can't figure it out on my own.

This is the error that pops up: The Value expression for the textrun ‘Textbox16.Paragraphs[0].TextRuns[1]’ contains an error: [BC30455] Argument not specified for parameter 'FalsePart' of 'Public Function IIf(Expression As Boolean, TruePart As Object, FalsePart As Object) As Object'.

Upvotes: 0

Views: 311

Answers (1)

Abhishek
Abhishek

Reputation: 2490

As the error was saying for the IIF function it was not able to find the FalsePart and it happened due to misplacing of the parentheses (yes you guessed it right).

Code below with correction - not tested though

=IIf((First(Fields!CustomerCountry.Value,"Invoice"))<>(First(Fields!SupplierCountry.Value,"Invoice")),0,((Sum(Fields!SellingPrice.Value, "Invoice")*(Parameters!BTW.Value))))

Upvotes: 1

Related Questions