Page 1 of 1
IIF Function
Posted: Thu Mar 16, 2017 5:55 pm
by davidanthonyb
Hello,
I am trying to find each line item of type "Return", and multiply the quantity by -1 if true, by +1 if false.
I am using the following expression in my databand filter:
Code: Select all
IIF((Table1.InvHistoryTypesInvHistoryType == "Return"), ((Decimal)Table1.InventoryHistoryQuantityChange * (-1)), ((Decimal)Table1.InventoryHistoryQuantityChange * (+1)))
I am receiving the error: "Cannot implicitly convert type 'object' to 'bool'
What cast am I missing or doing wrong?
Thanks,
David
Re: IIF Function
Posted: Thu Mar 16, 2017 8:42 pm
by Alex K.
Hello,
Please send us your report with test data which reproduces the issue for analysis.
Thank you.
Re: IIF Function
Posted: Thu Mar 16, 2017 10:23 pm
by davidanthonyb
Aleksey wrote:Hello,
Please send us your report with test data which reproduces the issue for analysis.
Thank you.
Hi Aleksey, thanks as usual for the response!
Attached is a version of the report that is receiving the casting error.
The image below is almost what I need.
https://ibb.co/jqH5ka
But what I need to do in the designer is change the quantity of all return transactions to a negative.
The ultimate goal would be to add a group summary summarizing the positive int issue transactions, and the negative int return transactions.
i.e.
return -10
return -5
issue 25
total 10
in addition to the IIF function, I did also try using the ternary operator, but ran into the same error. I am open to any other suggestions!
Thanks in advance!
David
Re: IIF Function
Posted: Thu Mar 16, 2017 10:39 pm
by davidanthonyb
Sorted it out!
I applied this directly to the Quantity data source, instead of adding to the databand filter
Code: Select all
{IIF((Table1.InvHistoryTypesInvHistoryType == "Return"), (Table1.InventoryHistoryQuantityChange * (-1)), (Table1.InventoryHistoryQuantityChange * (+1)))}
Thank you though for your response!
David
Re: IIF Function
Posted: Fri Mar 17, 2017 3:45 am
by Andrew
You are welcome, David!
Have a nice day!