vb.net - SSRS code to determine distinct count of a lookupset -
i trying create custom code, coupled ssrs expression, allow me display number of distinct values in lookupset array dataset ("faults"). expression in target dataset ("stations") this:
=code.countdistinct(lookupset(fields!stationnumber.value,fields!opid.value, fields!opid.value, "faults"))
unfortunately can't seem countdistinct function work. have functions allow me determine max, min, , average of lookupset, can't find me determine distinct count of items in lookupset.
i not vb expert, have been able create other simple functions little trouble. can't figure out countdistinct function, though.
any appreciated. perhaps there's better way find distinct count , reference in dataset in ssrs, besides using custom code? if so, please advise.
give try in code report. modified code little other answer return integer count of distinct values. reference.
public shared function countdistinct(m_array object()) integer system.array.sort(m_array) dim k integer = 0 integer = 0 m_array.length - 1 if > 0 andalso m_array(i).equals(m_array(i - 1)) continue end if m_array(k) = m_array(i) k += 1 next return k end function
i not sure code has changed enough qualify new answer. don't want think plagiarizing code.
Comments
Post a Comment