计算RDLC中的条件 [英] count condition in RDLC

查看:55
本文介绍了计算RDLC中的条件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在vb.net/rdlc中开发了一份报告。我想要的是在1年级为所有男学生(编码为1)计算学生ID。



这里是我在rdlc中所拥有的



= iif(Fields!Sex.Value = 1和Fields!grade.Value = 1,count(Fields!studentId.Value),0)



只有虚假部分正在执行我不知道为什么。请帮助我确定我可能出错的地方

I have developed a report in vb.net/rdlc. what i want is to have a count of studentID for all male students(coded as 1) in grade 1.

here is what i have in rdlc

=iif(Fields!Sex.Value = 1 and Fields!grade.Value = 1,count(Fields!studentId.Value),0)

only the false part is being executed i dont know why. Would please assist me to establish where i might go wrong

推荐答案

.Value是布尔然后尝试

Fields!Sex.Value和Fields! grade.Value

如果值是整数

也许DBNull

测试第一个
.Value is Boolean then try
Fields!Sex.Value and Fields!grade.Value
if value is integer
maybe DBNull
test 1st for this


put value <> 0而不是= 1

布尔值= -1 in vb not 1
put value <> 0 instead of =1
Boolean value = -1 in vb not 1


以下代码是测试和工作

The following code is test and worked
Class TItem
    Public Property Sex As Integer
    Public Property Grade As Integer
    Public Property studentID As Long
End Class

Sub Main()

    Dim Items = { _
        New TItem With {.Sex = 1, .Grade = 1}, _
        New TItem With {.Sex = 1, .Grade = 1}, _
        New TItem With {.Sex = 0, .Grade = 1}, _
        New TItem With {.Sex = 0, .Grade = 1} _
    }

    Dim ItemsList As New List(Of TItem)(Items)

    Dim n = Aggregate Item As TItem In ItemsList Where Item.Sex = 1 And Item.Grade = 1 Into Count()

    MsgBox(n)
End Sub


这篇关于计算RDLC中的条件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆