Forum Discussion

VENKAB05's avatar
VENKAB05
New Contributor III
2 years ago

Default Value of a Delimited List Parameter Not Working

Hello Everyone,

I am using a Delimited List Parameter which results a list of comma separated values from SQL through XFBR.

When i use this parameter in Dashboard, it always shows as blank when it starts up, even though i have set the default value property.

Looks like its a limition at this point of time.

Are the any alternate ways we can use the default value for Delimited List Parameter in Dashboards ?

  • JackLacava's avatar
    JackLacava
    Honored Contributor

    Default values can be a bit funny, because of quirks with how they're (not) populated when the list of choices is not known at the very beginning.

    One workaround is to have an extender running at dashboard load, pushing a default value directly in the parameter.

    • Richard_Mayo's avatar
      Richard_Mayo
      New Contributor III

      Hi Jack,

      Thanks for this comment - I'm having this exact problem! Do you happen to have (or has anyone else listening) any example code for a dashboard extender that would push a value into a parameter?

      I've been using the following which is essentially using the brapi.dashboards.SetLiteralParameterValue command but I've found it doesn't always work. In fact I believe I might have misunderstood the basic function of this code as what it seems to do is populate the "Default value" of a parameter rather than the actual value assigned to it (the latter is what I'm trying to do).

      Any suggestions would be welcomed!

      Regards,
      Richard

      • VENKAB05's avatar
        VENKAB05
        New Contributor III

        Hi Richard,

        The above 2 screenshots might help you.

        I followed similar to above and i was able to get the default value.

        Balaji V

  • ChristianW's avatar
    ChristianW
    Valued Contributor

    In the past, I also used xfbr to create comma separated lists for Delimited List Parameters. I did it to overcome problems I had with dynamic Bound List Parameters, if they needed parameters to query the database as well.

    The error was caused because the custom parameter dictionary was not yet populated. To avoid the problem, you just need to test, if the custom parameter dictionary has data, before you run your code.

    I‘m not at my desk, I will post a sample Monday.

    • ChristianW's avatar
      ChristianW
      Valued Contributor

      And here is the code sample:

      For Each paramValue As String In args.NameValuePairs.Values
      	If StringHelper.DoesStringHaveCustomSubstVars(paramValue) Then Return Nothing
      Next

      You have to place it after this

      Case Is = DashboardDataSetFunctionType.GetDataSet

      and before any other if or select statementIf any argument contains unresolved parameters, it won't continue.

      I hope this helps and cheers