视觉工作室'iif功能'

时间:2013-04-03 15:41:12

标签: visual-studio visual-studio-2005

我在visual studio中创建了一个报告,显示了4个项目: -

  • 发票金额
  • 付费金额
  • 未付金额
  • 其中逾期

如下所示: enter image description here

我想要的是在数据集中的字段上创建一个计算,以便在未付款金额超过30天时显示我的项目“已逾期”的金额。

我的数据集在这里: enter image description here

我试过这样的事情:

=iif((Sum(Fields!DaysOutstanding.Value, "Services")>30, Sum(Fields!BalanceOutstanding.Value, "Services"))

但这显然不起作用。

任何人都可以指出正确的diorection吗?

非常感谢。

2 个答案:

答案 0 :(得分:1)

您需要三个参数。你只有两个。

http://msdn.microsoft.com/en-us/library/27ydhh0d%28v=vs.80%29.aspx

Public Function IIf( _
   ByVal Expression As Boolean, _ 
   ByVal TruePart As Object, _ 
   ByVal FalsePart As Object _ 
) As Object

我不确定你为什么在这里使用SUM。对于你的情况,你需要通过你的数据来做这样的事情(显然是伪代码):

 iif(
  If the DaysOutstanding.Value is greater than 30,
  then add balanceoutstanding.value to overdueunpaid.value,
  else add nothing
  )

答案 1 :(得分:0)

以下代码将我的问题排除在外

=iif((
Fields!DaysOutstanding.Value) > 30,
(Fields!BalanceOutstanding.value)  + (Fields!OverdueUnpaid.Value),
 nothing
 )
相关问题