Partager via


ParameterFieldDefinition.ApplyDefaultValues Méthode

Applique les valeurs au groupe de valeurs par défaut pour un paramètre spécifié dans un rapport.

[Visual Basic]

Public Overrideable Sub ApplyDefaultValues( _
   ByVal defaultValue As CrystalDecisions.Shared.ParameterValues _
)

[C#]

public virtual void ApplyDefaultValues(
   CrystalDecisions.Shared.ParameterValues defaultValue
);

Paramètres

  • defaultValue
    Contient les valeurs par défaut définies pour le paramètre.

Remarques

La valeur par défaut définie doit entrer dans le cadre des propriétés EditMask, MaximumValue et MinimumValue, si celles-ci ont été définies. Pour en savoir plus sur les masques d'édition, voir Limiting Entry Type and Format in Parameters.

Exemple

[VJ#]

      private void setParameters(Float startValue, Float endValue,
         Integer discreteValue1, Integer discreteValue2, Integer minValue,
         Integer maxValue)
      {
         ParameterDiscreteValue discreteParam = new
            ParameterDiscreteValue();
         ParameterRangeValue rangeParam = new ParameterRangeValue();
         ParameterFieldDefinition paramField;
         ParameterValues currentValues;
         ParameterValues defaultValues;
      
         paramField = Report.get_DataDefinition()
            .get_ParameterFields().get_Item("RangedParam");
         rangeParam.set_StartValue(startValue);
         rangeParam.set_EndValue(endValue);
         currentValues = paramField.get_CurrentValues();
         currentValues.Add(rangeParam);
         paramField.ApplyCurrentValues(currentValues);
      
         paramField = Report.get_DataDefinition()
            .get_ParameterFields().get_Item("DiscreteParam", "sub1");
      
         paramField.ApplyMinMaxValues(minValue, maxValue);
      
         discreteParam.set_Value(discreteValue1);
         defaultValues = paramField.get_DefaultValues();
         defaultValues.Add(discreteParam);
         paramField.ApplyDefaultValues(defaultValues);
      
         discreteParam = new ParameterDiscreteValue();
         discreteParam.set_Value(discreteValue2);
         defaultValues = paramField.get_DefaultValues();
         defaultValues.Add(discreteParam);
         paramField.ApplyDefaultValues(defaultValues);
      }
      
[Visual Basic]

      Private Sub SetParameters _
         (ByVal startValue As Double, ByVal endValue As Double, _
         ByVal discreteValue1 As Integer, _
         ByVal discreteValue2 As Integer, _
         ByVal minValue As Integer, ByVal maxValue As Integer)
      
         Dim discreteParam As New ParameterDiscreteValue()
         Dim rangeParam As New ParameterRangeValue()
         Dim paramField As ParameterFieldDefinition
         Dim currentValues As ParameterValues
         Dim defaultValues As ParameterValues
      
         paramField = _
         Report.DataDefinition.ParameterFields.Item("RangedParam")
         rangeParam.StartValue = startValue
         rangeParam.EndValue = endValue
         currentValues = paramField.CurrentValues
         currentValues.Add(rangeParam)
         paramField.ApplyCurrentValues(currentValues)
      
         paramField = _
            Report.DataDefinition.ParameterFields.Item("DiscreteParam", "sub1")
      
         paramField.ApplyMinMaxValues(minValue, maxValue)
      
         discreteParam.Value = discreteValue1
         defaultValues = paramField.DefaultValues
         defaultValues.Add(discreteParam)
         paramField.ApplyDefaultValues(defaultValues)
      
         discreteParam = New ParameterDiscreteValue()
         discreteParam.Value = discreteValue2
         defaultValues = paramField.DefaultValues
         defaultValues.Add(discreteParam)
         paramField.ApplyDefaultValues(defaultValues)
      End Sub
      
[C++]

      void SetParameters(float startValue, float endValue,
      int discreteValue1, int discreteValue2, int minValue,
      int maxValue)
      {
         ParameterDiscreteValue* discreteParam = new
         ParameterDiscreteValue();
         ParameterRangeValue* rangeParam = new ParameterRangeValue();
         ParameterFieldDefinition* paramField;
         ParameterValues* currentValues;
         ParameterValues* defaultValues;
      
         paramField =
         Report->DataDefinition->ParameterFields->Item["RangedParam"];
         rangeParam->StartValue = __box(startValue);
         rangeParam->EndValue = __box(endValue);
         currentValues = paramField->CurrentValues;
         currentValues->Add(rangeParam);
         paramField->ApplyCurrentValues(currentValues);
         
         paramField = Report->DataDefinition->ParameterFields->Item
         ["DiscreteParam", "sub1"];
      
         paramField->ApplyMinMaxValues(__box(minValue), __box(maxValue));
      
         discreteParam->Value = __box(discreteValue1);
         defaultValues = paramField->DefaultValues;
         defaultValues->Add(discreteParam);
         paramField->ApplyDefaultValues(defaultValues);
      
         discreteParam = new ParameterDiscreteValue();
         discreteParam->Value = __box(discreteValue2);
         defaultValues = paramField->DefaultValues;
         defaultValues->Add(discreteParam);
         paramField->ApplyDefaultValues(defaultValues);
      };
      
[C#]

      private void SetParameters(float startValue, float endValue,
         int discreteValue1, int discreteValue2, int minValue,
         int maxValue)
      {
         ParameterDiscreteValue discreteParam = new
            ParameterDiscreteValue();
         ParameterRangeValue rangeParam = new ParameterRangeValue();
         ParameterFieldDefinition paramField;
         ParameterValues currentValues;
         ParameterValues defaultValues;
      
         paramField = 
            Report.DataDefinition.ParameterFields["RangedParam"];
         rangeParam.StartValue = startValue;
         rangeParam.EndValue = endValue;
         currentValues = paramField.CurrentValues;
         currentValues.Add(rangeParam);
         paramField.ApplyCurrentValues(currentValues);
         
         paramField = Report.DataDefinition.ParameterFields
            ["DiscreteParam", "sub1"];
      
         paramField.ApplyMinMaxValues(minValue, maxValue);
      
         discreteParam.Value = discreteValue1;
         defaultValues = paramField.DefaultValues;
         defaultValues.Add(discreteParam);
         paramField.ApplyDefaultValues(defaultValues);
      
         discreteParam = new ParameterDiscreteValue();
         discreteParam.Value = discreteValue2;
         defaultValues = paramField.DefaultValues;
         defaultValues.Add(discreteParam);
         paramField.ApplyDefaultValues(defaultValues);
      }
      

Configuration requise

Espace de noms CrystalDecisions.CrystalReports.Engine

Assembly CrystalDecisions.CrystalReports.Engine (CrystalDecisions.CrystalReports.Engine.dll)

Voir aussi

ParameterFieldDefinition Classe | ParameterFieldDefinition Membres | CrystalDecisions.CrystalReports.Engine Espace de noms

**

©2005 Business Objects SA. Tous droits réservés.

Business Objects SA.
http://www.france.businessobjects.com/
Services de support
http://www.businessobjects.com/support/