Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. crystal reports parameter

crystal reports parameter

Scheduled Pinned Locked Moved C#
helpcsharpsalesregextutorial
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Naveed Kamboh
    wrote on last edited by
    #1

    :~ I am sorry but i am posting this again because I didn't get reply for my problem if any one can help me please. I want to pass parameters to crystal reports but i dont know how i found example on microsoft site // Declare variables needed to pass the parameters // to the viewer control. ParameterFields paramFields = new ParameterFields (); ParameterField paramField = new ParameterField (); ParameterDiscreteValue discreteVal = new ParameterDiscreteValue (); ParameterRangeValue rangeVal = new ParameterRangeValue (); // The first parameter is a discrete parameter with multiple values. // Set the name of the parameter field, this must match a // parameter in the report. paramField.ParameterFieldName = "Customer Name"; // Set the first discrete value and pass it to the parameter. discreteVal.Value = "AIC Childrens"; paramField.CurrentValues.Add (discreteVal); // Set the second discrete value and pass it to the parameter. // The discreteVal variable is set to new so the previous settings // will not be overwritten. discreteVal = new ParameterDiscreteValue (); discreteVal.Value = "Aruba Sport"; paramField.CurrentValues.Add (discreteVal); // Add the parameter to the parameter fields collection. paramFields.Add (paramField); // The second parameter is a range value. The paramField variable // is set to new so the previous settings will not be overwritten. paramField = new ParameterField (); // Set the name of the parameter field, this must match a // parameter in the report. paramField.ParameterFieldName = "Customer ID"; // Set the start and end values of the range and pass it to the // parameter. rangeVal.StartValue = 42; rangeVal.EndValue = 72; paramField.CurrentValues.Add (rangeVal); // Add the second parameter to the parameter fields collection. paramFields.Add (paramField); // Set the parameter fields collection into the viewer control. crystalReportViewer1.ParameterFieldInfo = paramFields; Problem is that when i write this code for my reports in c# I am not finding "paramField.ParameterFieldName" in intellisence. I am seeing some other methods but they gives error. I am using V.S. 2003 and crystal report 9.0 Please can any one tell me why its happening I would be obliged. Naveed Kamboh

    A 1 Reply Last reply
    0
    • N Naveed Kamboh

      :~ I am sorry but i am posting this again because I didn't get reply for my problem if any one can help me please. I want to pass parameters to crystal reports but i dont know how i found example on microsoft site // Declare variables needed to pass the parameters // to the viewer control. ParameterFields paramFields = new ParameterFields (); ParameterField paramField = new ParameterField (); ParameterDiscreteValue discreteVal = new ParameterDiscreteValue (); ParameterRangeValue rangeVal = new ParameterRangeValue (); // The first parameter is a discrete parameter with multiple values. // Set the name of the parameter field, this must match a // parameter in the report. paramField.ParameterFieldName = "Customer Name"; // Set the first discrete value and pass it to the parameter. discreteVal.Value = "AIC Childrens"; paramField.CurrentValues.Add (discreteVal); // Set the second discrete value and pass it to the parameter. // The discreteVal variable is set to new so the previous settings // will not be overwritten. discreteVal = new ParameterDiscreteValue (); discreteVal.Value = "Aruba Sport"; paramField.CurrentValues.Add (discreteVal); // Add the parameter to the parameter fields collection. paramFields.Add (paramField); // The second parameter is a range value. The paramField variable // is set to new so the previous settings will not be overwritten. paramField = new ParameterField (); // Set the name of the parameter field, this must match a // parameter in the report. paramField.ParameterFieldName = "Customer ID"; // Set the start and end values of the range and pass it to the // parameter. rangeVal.StartValue = 42; rangeVal.EndValue = 72; paramField.CurrentValues.Add (rangeVal); // Add the second parameter to the parameter fields collection. paramFields.Add (paramField); // Set the parameter fields collection into the viewer control. crystalReportViewer1.ParameterFieldInfo = paramFields; Problem is that when i write this code for my reports in c# I am not finding "paramField.ParameterFieldName" in intellisence. I am seeing some other methods but they gives error. I am using V.S. 2003 and crystal report 9.0 Please can any one tell me why its happening I would be obliged. Naveed Kamboh

      A Offline
      A Offline
      Alex Korchemniy
      wrote on last edited by
      #2

      I haven't been at CP for a while. Hi everyone. Naveed, if you search through previous post I bet this question was answer multiple times. I quickly pulled up a file using Google desktop search and I found a function that I used on a previous project. Take a look at this. It might help you:

      private void SetParameter(string name, string val)
      {
      ParameterFieldDefinitions paramFlds = report.DataDefinition.ParameterFields; // Get the parameter fields
      ParameterFieldDefinition paramFld = paramFlds[name]; // Get a specific one
      ParameterDiscreteValue discreteValue = new ParameterDiscreteValue(); // Create a value type
      ParameterValues paramValues = paramFld.CurrentValues; // Get the collection of current values
      paramValues.Clear(); // Clear the current
      discreteValue.Value = val; // Set the value
      paramValues.Add(discreteValue); // Add the value type
      paramFld.ApplyCurrentValues(paramValues); // Apply the parameters to the document
      }

      Alex Korchemniy

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups