2114469 - Dynamic Parameter .BrowseField value always returns NULL value

SAP Knowledge Base Article - Public

2114469 - Dynamic Parameter .BrowseField value always returns NULL value

Symptom

Dynamic Parameter BrowseField value always returns null. This was fixed for Static Parameters in ADAPT01470106 Need this fixed for Dynamic Parameters now.

Environment

  • Crystal Reports for Visual Studio
  • BOE .NET SDK 4.x

Reproducing the Issue

In a C# .NET test app one way of getting the Parameters values is as follows:

private void getRangeValues(CrystalDecisions.ReportAppServer.DataDefModel.ParameterField paramfield)

{

    string textBox1 = "\n"; // String.Empty;

    string name = paramfield.Name;

    int currValCount = paramfield.CurrentValues.Count;

    int defValCount = paramfield.DefaultValues.Count;

    int z = 0;

 

    btnReportObjects.Text += "Range Param Name: ";

 

    if (paramfield.BrowseField != null) // BrowseField in dynamic parameters is always null, I think I asked R&D about but not sure why they can't fix it.

        btnReportObjects.AppendText(paramfield.Name.ToString() + "\n" + paramfield.BrowseField.FormulaForm.ToString());

    else

        btnReportObjects.AppendText(paramfield.Name.ToString() + "\n");

 

    if (paramfield.ParameterType.ToString() == "crParameterFieldTypeStoredProcedureParameter")

        btnReportObjects.AppendText(": Store Procedure Parameter \nBased on field: " + paramfield.FormulaForm + "\n");

 

    if (paramfield.ParameterType.ToString() == "crParameterFieldTypeReportParameter")

    {

        // provided by DEV to tell if the param is dynamic or not

        if (rpt.DataDefinition.ParameterFields[iCnt].Attributes != null && rpt.DataDefinition.ParameterFields[iCnt].Attributes.ContainsKey("IsDCP"))

        {

            Hashtable objAttributes = rpt.DataDefinition.ParameterFields[iCnt].Attributes;

            YorN = (Boolean)objAttributes["IsDCP"];

        }

        if (YorN)

        {

            if ((dynamic)paramfield.Usage == 25)

                btnReportObjects.AppendText(": (Dynamic Cascading Parameter) ( LOV )\nBased on field: " + paramfield.Description.ToString() + "\n"); //.Remove(0, 6) + "\n"); // paramfield.FormulaForm + "\n");

            else // next line I get the Description because this has the field name in it unless modified

                btnReportObjects.AppendText(": (Dynamic Parameter) \nBased on field: " + paramfield.Description.ToString() + "\n"); //.Remove(0, 6) + "\n"); // paramfield.FormulaForm + "\n");

            //btnReportObjects.AppendText(": No Initial Value \n");

        }

        else

            btnReportObjects.AppendText(": (Crystal Parameter) \nBased on field: " + paramfield.FormulaForm + "\n");

    }

 

 

public Boolean isParameterDynamic(CrystalDecisions.CrystalReports.Engine.ReportDocument rpt, int iCnt, bool YorN)

{

    if (rpt.DataDefinition.ParameterFields[iCnt].Attributes != null && rpt.DataDefinition.ParameterFields[iCnt].Attributes.ContainsKey("IsDCP"))

    {

        Hashtable objAttributes = rpt.DataDefinition.ParameterFields[iCnt].Attributes;

        YorN = (Boolean)objAttributes["IsDCP"];

        return YorN;

    }

    return YorN;

}

Resolution

This limitation has been escalated to R&D for a solution.

Update: Using Crystal Reports for Visual Studio .NET SDK you can now get the field name of the Parameter for LOV's ( Dynamic )

However, there is no way that R&D could find they coudl make this work for BOE .NET SDK because the LOV is saved in the Repository and no access to it from CR for VS or BOE .NET SDK.

See KBA  1726974 for more info about BOE SDK.

Keywords

Crystal Reports for Visual Studio, Dynamic Parameter BrowseField value, Dynamic Parameter, BrowseField , KBA , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , Problem

Product

SAP Crystal Reports, developer version for Microsoft Visual Studio