0
votes

thx for reading my question. In my job, we are searching for one reporting tool. So far Crystal Reports has been the choice. The reason is the easy and fast development. We wanna create our own app, like a Central Reports. I need to know, if i can create a grouping generic class. I know that Crystal Reports offers the grouping choice possibility, but, its for only one report at a time. We have many clients(80 average), many reports(20-30 per client). So, yeah, its hard to mantain about 1600-2400 reports with only two people.

The concept behind is: For each client we have a text within the database, this text is an view with the information required by the report. So we can have one report, that display different information given a client. One layout for multiple clients, this is part of the new project, a way i found to eliminate the need for multiple layouts, and be able to aggregate all of them in one application.

What this class would do ?

It would get the text, analyze the fields, and based on this analysis send a windows form showing the grouping possibilities. Crystal Reports already do this, but you have to manually set the grouping and formula options for each report. Could we be able to create a class that would do this job automatically ?

UPDATE:

For dynamic column selection i got this solution:

 if (chbCode.Checked)
        {
            columnNo++;
            query = query.Insert(query.Length, "Codinome as Column" +
            columnNo.ToString());

            paramField = new ParameterField();
            paramField.Name = "col" + columnNo.ToString();
            paramDiscreteValue = new ParameterDiscreteValue();
            paramDiscreteValue.Value = "Codinome";
            paramField.CurrentValues.Add(paramDiscreteValue);
            //Add the paramField to paramFields
            paramFields.Add(paramField);
        }
        if (chbFirstName.Checked)
        {
            columnNo++;
            if (query.Contains("Column"))
            {
                query = query.Insert(query.Length, ", ");
            }
            query = query.Insert(query.Length, "NomeEmpresa as Column" +
            columnNo.ToString());

            paramField = new ParameterField();
            paramField.Name = "col" + columnNo.ToString();
            paramDiscreteValue = new ParameterDiscreteValue();
            paramDiscreteValue.Value = "Nome da Empresa";
            paramField.CurrentValues.Add(paramDiscreteValue);
            //Add the paramField to paramFields
            paramFields.Add(paramField);
        }

So i have this initial form, just for testing. Its ugly, i know ; D. The left side holds the checkbox. For each checkbox there is a parameter field on the report. Here is the link from where i got the idea: http://www.codeproject.com/Articles/20670/Dynamic-Crystal-Report-with-C?fid=466537&tid=3776908

I wanna thank everybody who belongs to this great comunity, Best regards, Diego.

2

2 Answers

1
votes

I will try to answer to extent I understand your question.

From your post you are looking for a report that can satisfy multiple clients.

  1. If columns are same for clients then its a simple job write a formula with "IF" condition for all clients and use that formula in a group and create a parameter with the client details. You formula should be if in parameter client X is selected then report group formula will take this input and display the report. IF you wish you can even limit for the client details.

  2. If columns are different then its a bit difficult job create the report with the columns of all clients and write supress condition for fields in a way that if client X is slected then columns for that client should get displayed. Follow point 1 to create the client selection.

Note: Above solutins is given expecting that data fetching is from single database.

0
votes

Here is the solution, i wanna thx to Siva for his tips.

//Temp string to receive column name
String temp = Ds.Customer.Column3Column.ToString();


//objRpt is my instancied report : objRpt = new CrystalReport1();
//I set the formulafield[0] with the column name
objRpt.DataDefinition.FormulaFields[0].Text = "{Customer." + temp.Replace("{", "") + "}";

I create a temp string to receive the column name that is going to be the header group. Then i set the formulafield text with the column so it'll know how to group.