Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

594
Vistas
To use IIF() for checking a length of spliited string before calling GetValue(), is still error

In rdlc report. A subreport was created 4 parameters for received from main report. But sometime a main report may send less than four value. For example: A String was sent from these VB.Net code.

Dim strProcessCode As String = {"A,B"}

A string includes only two value.(A and B) So I using splitted this string by using expression for each parameter like these

=iif(Split(Parameters!pProcessCode.Value, ",").Length>0,
           (Split(Parameters!pProcessCode.Value, ",")).GetValue(0)
           ,nothing)   ''For first parameter

First and second parameters is fine. But It has a problem when I prepared a value for third parameter. Despite it used the same way.

    =iif(Split(Parameters!pProcessCode.Value, ",").Length>2,
           (Split(Parameters!pProcessCode.Value, ",")).GetValue(2)
           ,nothing)   ''For third parameter

It show this error message

Error: Subreport could not shown.

How to fixed it?

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

It would be easier to read and maintain if you could break it down into an If.. ElseIF.. Else or a Select.

Function ReturnResult(byval pProcessCodeValue as string) as string
    If Instr(0, pProcessCodeValue,",",vbTextCompare) = 0 Then
       ReturnResult = pProcessCodeValue
       Exit Function
    End If 
    dim arr() as string
    arr = Split(pProcessCodeValue , ",")
    ReturnResult = arr(arr.Length)
End Function

Call it:

=ReturnResult(Parameters!pProcessCode.Value)

However, with SSRS you may need to use nested IIF's, eg:

=iif(Split(Parameters!pProcessCode.Value, ",").Length = 0,
       (Split(Parameters!pProcessCode.Value, ",")).GetValue(0)
       , iif(Split(Parameters!pProcessCode.Value, ",").Length = 1,
       (Split(Parameters!pProcessCode.Value, ",")).GetValue(1)
       , iif(Split(Parameters!pProcessCode.Value, ",").Length = 2,
       (Split(Parameters!pProcessCode.Value, ",")).GetValue(2)
       , nothing)) 
    ) 
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda