Display Parameter Value in Header up to 5 values.

  • Please See attached Image.

    On my Report Have use 4 main parameter which I have to display all parameter value in text box before data display.

    If user select nothing in doctor parameter we display by default "All" and if user pass value then display that parameter value in text box.

    Now, I have little change from user they want to display parameter value in text box up to five and if they pass more that five then display message "More than Five Values Selected".

    Please see attached image than better idea even I highlighted with red color .

    even I also attached my custom code function which I am using to display values.and I tried to compare up to five but not helping out getting error. please check my below custom code

    Public Function FormatParamsAsTitle(strFacilityGroup as string, strFacility as string, strVisitTypeGroup as string, strVisitType as string, strTeam as string, strDoc as string) as String

    dim formattedFacility as string

    dim formattedVisitType as string

    dim formattedDoc as string

    dim formattedTeam as string

    dim Count as Integer

    Count = 5

    if strFacilityGroup = string.Empty and strFacility = string.Empty then

    formattedFacility = "All"

    elseif strFacilityGroup <> string.Empty then

    formattedFacility = strFacilityGroup

    else

    formattedFacility = strFacility.Replace("'","").Replace(",",", ")

    end if

    formattedFacility = "Facility: " & formattedFacility & Environment.NewLine

    if not string.IsNullOrEmpty(strVisitTypeGroup) then

    formattedVisitType=strVisitTypeGroup

    elseif strVisitType = string.empty then

    formattedVisitType = "All"

    else

    formattedVisitType = strVisitType.Replace("'","") 'remove single quotes

    end if

    formattedVisitType = "Visit Types: " & formattedVisitType & Environment.NewLine

    if strDoc = "" then

    formattedDoc = "All"

    else if count = strDoc.Count() then

    formattedDoc = "More Than Five Values"

    else

    formattedDoc =strDoc.Replace("'","") 'remove single quotes

    end if

    formattedDoc = "Doctors: " & formattedDoc

    if strTeam = "noDisplay" then

    formattedTeam = ""

    else

    if strTeam = "" then

    formattedTeam = "All"

    else

    formattedTeam = strTeam

    end if

    formattedTeam ="Teams: " & formattedTeam & Environment.NewLine

    end if

    FormatParamsAsTitle = String.Format("{0}{1}{2}{3}", formattedFacility, formattedVisitType, formattedTeam, formattedDoc)

    End Function

    and in report textbox expression

    =Code.FormatParamsAsTitle(

    iif(Parameters!facilityGroup.Value=string.Empty,"",First(Fields!FacilityGroupNames.Value, "dsFacilityGroup")),

    iif(Parameters!facility.Value=string.Empty,"",First(Fields!FacilityNames.Value, "dsFacilityName")),

    iif(Parameters!visitType.Value=string.Empty,"",First(Fields!VisitTypeNames.Value, "dsVisitType")),

    iif(Parameters!visitTypeGroup.Value=string.Empty,"",First(Fields!VisitTypeGroupNames.Value, "dsVisitTypeGroup")),

    iif(First(Fields!ConfigValue.Value, "dsConfigTeamDisplay").ToString()="false","noDisplay",

    iif(Parameters!team.Value=string.Empty,"",First(Fields!TeamNames.Value, "dsTeam"))),

    iif(Parameters!doctor.Value=string.Empty,"",First(Fields!DoctorNames.Value, "dsDocName")))

  • Hi zoom19,

    I don't think there's an actual need to create custom code. I put the same logic into my reports using the following textbox expression:

    = "Facility: "

    + iif(Parameters!facilityGroup.Count = countrows("dsFacilityGroup")

    , "All"

    , iif(Parameters!facilityGroup.Count > 5

    , format(Parameters!facilityGroup.Count) + " of " format(countrows("dsFacilityGroup")) + " selected"

    , join(Parameters!facilityGroup.Label, ", ")

    )

    )

    Hope this helps.

    Kind regards,

    Linda

  • Hi Linda and thanks to give me suggestion.

    es You are correct we are using that way but I found another solution as well with custom code.

    I am posted here might be it's useful for some one else.below I created another function which count character string then I used this in my main function.

    Public Function CountCharacter(ByVal value As String, ByVal ch As Char) As Integer

    Dim cnt As Integer = 0

    For Each c As Char In value

    If c = ch Then cnt += 1

    Next

    Return cnt

    End Function

    Below is My main function where I used my countcharacter function

    Public Function FormatParamsAsTitle(strFacilityGroup as string, strFacility as string, strVisitTypeGroup as string, strVisitType as string, strTeam as string, strDoc as string) as String

    dim formattedFacility as string

    dim formattedVisitType as string

    dim formattedDoc as string

    dim formattedTeam as string

    dim count as integer

    Count = 5

    if strFacilityGroup = string.Empty and strFacility = string.Empty then

    formattedFacility = "All"

    elseif strFacilityGroup <> string.Empty then

    formattedFacility = strFacilityGroup

    else

    formattedFacility = strFacility.Replace("'","").Replace(",",", ")

    [highlight]

    if count <=CountCharacter( formattedFacility , ",")

    formattedFacility ="More Than Five Facility Selected"

    End if

    [/highlight]

    end if

    formattedFacility = "Facility: " & formattedFacility & Environment.NewLine

    if not string.IsNullOrEmpty(strVisitTypeGroup) then

    formattedVisitType=strVisitTypeGroup

    elseif strVisitType = string.empty then

    formattedVisitType = "All"

    else

    formattedVisitType = strVisitType.Replace("'","") 'remove single quotes

    [highlight]

    if count <=CountCharacter( formattedVisitType , ",")

    formattedVisitType ="More Than Five Visit Type Selected"

    End if

    [/highlight]

    end if

    formattedVisitType = "Visit Types: " & formattedVisitType & Environment.NewLine

    if strDoc = "" then

    formattedDoc = "All"

    else

    formattedDoc =strDoc.Replace("'","") 'remove single quotes

    [highlight]

    if count <=CountCharacter( formattedDoc , ",")

    formattedDoc ="More Than Five Doctor Selected"

    End if

    [/highlight]

    end if

    formattedDoc = "Doctors: " & formattedDoc

    if strTeam = "noDisplay" then

    formattedTeam = ""

    else

    if strTeam = "" then

    formattedTeam = "All"

    else

    formattedTeam = strTeam.Replace("'","") 'remove single quotes

    [highlight]

    if count <=CountCharacter( formattedTeam , ",")

    formattedTeam ="More Than Five Team Selected"

    End if

    [/highlight]

    end if

    formattedTeam ="Teams: " & formattedTeam & Environment.NewLine

    end if

    FormatParamsAsTitle = String.Format("{0}{1}{2}{3}", formattedFacility, formattedVisitType, formattedTeam, formattedDoc)

    End Function

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply