Multiple field values to subreport error - join

I have a parent report that feeds one of the field values into a subreport. But the problem is that there this field value can include multiple records. For simplicity, assume that this field value is called color, where possible values might be orange, red, and green. I need to pass all of these value to the subreport, not just one. I have tried passing the values this way into the Color parameter of the subreport:
=Fields!Color.Value
But this doesn't work and gives me an error. I have also tried:
=join(Fields!Color.Value,",")
This also gives me an error on the subreport
I have also tried both of the above as an expression in a textbox in the parent report and I get #Error displayed on the parent report. I was able to successfully get just the first value to appear by using a similar expression and the First function. But I am not able to get all of the values to display in this textbox on the parent report? how can I do this or at least pass all of the values to this subreport?

The easy solution is if Color is already a parameter - I would pass this expression in the subreport:
=Parameters!Color.Value
If Color is not a parameter, I would add a column to the driving dataset in the parent report using a SELECT ... FOR XML to concatenate the relevant Color values together. Then you can pass that field to the subreport.

Related

RDLC Reports: how to hide text, depending on whether all fields in dataset value are NULL?

I am creating RDLC Reports (this one is a subreport actually), that hides a specific Text-Box depending on data available/missing.
Specifically, I want to hide a Text Box, using an "Expression", when all values of a specific DataSet are null. Currently I do only check the first value like so:
=(IsNothing(First(Fields!EventDescription.Value, "MyDataSet")))
This works, regarding only the first item in the DataSet, or when it's empty. How can I check for "All". Is there an "All" operator?
I now have
=((Sum(IIF(IsNothing(Fields!EventDescription.Value),0,1), "MyDataSet") ) = 0)
which looks a little complicated, but works. It
checks whether the given Field is NULL
if not so, provides the integer value 1
sums all those values up
hides the text box, when the sum is zero (all fields have been null)
Essentially this converts an aggregate comparison into a sum.

Parameter based on SP is missing a value SSRS Visual Studio 2015

1- I have a shared dataset that gets style properties from SQL server by calling a stored procedure. These are, for example, a field with an array of color codes.
2- I load the shared dataset within a dataset embedded in my report ("use a shared dataset").
3- I create a hidden parameter "color" which available values are set to None; Default values are set to "Get values from a query" and value field is set to the color array in question.
When I run the report, I get the "parameter is missing a value" exception. What's weird is that I have another report running the same settings that works perfectly fine.
Any tips?
You need to have both the Available Values and Default Values pointed to the query. Also check the "Allow multiple values" setting in your parameter properties. Depending on how you're using the parameter values throughout the report, you may need to make use of the Join and Split functions to pull out the individual values from the array, but that would be a separate issue.

How to make TProgressColumn work when used with LiveBindings and datasets

My goal is to have a TGrid with several columns, connected to a TClientDataSet via LiveBindings. One of the columns is of type TProgressColumn.
The grid displays the data, but the progress bar column shows nothing (i.e. 0% progress).
The TProgressColumn is connected to a field of type ftInteger. The values in this field are between 0 and 100.
I've tried with ftSingle, but with no luck.
I set the type of the column to be TProgressColumn via ColumnStyle property, available under TLinkGridToDataSourceBindSourceDB/Columns.
The strange thing is that when I use TPrototypeBindSource to generate values - the TProgressColumn works, but only for ftUInteger values. It fails for ftInteger generators.
Here is a little demo (Delphi XE7):
When I put a breakpoint in TProgressCell.DrawCell() and step over the two conditions for Value.IsOrdinal and Value.IsType are skipped and ClampValue receives a value "Min" which is 0.
There seems to be something wrong with the value, passed to the function.
Is there something special when working with TProgressColumn? Do I need to use CustomFormat, CustomParse in TLinkGridToDataSourceColumn?
Is that a bug or I miss something?
UPDATE:
Thanks to "nompa" the mystery was solved!
In fact "asInteger" is the well known property of the TField class i.e.:
someDataSet.fieldByName('myFieldName').asInteger
In CustomFormat property you can get access to many things, including self.asInteger properties.
More information here:
Using Custom Format and Parse Expressions in LiveBindings
Using binding expressions in the CustomFormat property of a TLinkPropertyToField component
Formatting your Fields
How to treat an Integer field as a Boolean?
The value is string by default, not matter is a integer field. In property CustomFormat write AsInteger.
The value will be take as integer and the progress now is visible.

How to remove a FIELD of "Text Object" in FastReport that has NULL Value

Here my table:
QUESTION:
How to remove the Field that has NULL Value?
How is the appropriate Algorithm ?
You can suppress the printing of the label by setting its Visible property in the OnBeforePrint event in the report.
However, this will still leave you with a blank line, so you can solve this in one of three ways (in ascending order of difficulty).
Firstly, you can ignore suppression of the label printing detailed above and set the Text property of the field to be 'No' if the DB field is NULL in the OnBeforePrint or OnGetText events.
Alternatively, you can define a memo field and in the OnBeforePrint method calculate its Text property to only include the Non-Null values and their labels.
Finally, you can look at the documentation and use scripting to modify the Report Engine's CurrX and CurrY properties in order to suppress the blank lines.

Combine multiple columns containing similar values into one column for use in graph inside Crystal Reports

I have 3 fields, Action1, Action2 and Action3 contained in one report. Each Action field is selected from the same list of values. I would like to graph a count of these values by the value of the field and not field itself. I need one graph and not one graph per Action field. I have tried to combine the field values into an array in the details section, but the report shows the concatenated string values "Action1, Action2, Action3', as a single value in the graph. I tried to graph using "on change of", but it will only allow 2 fields and not 3. Is there a way to count these values regardless of the Action field where they are found?
I have been working with Crystal for years, but can't figure this out for whatever reason.
I was never able to find a solution to this issue inside of Crystal Reports itself. What I ended up doing was creating a stored procedure in SQL to use as the data source. In the stored procedure I basically performed a cross join such that there was only 1 Action returned per record. In CR I then was able to summarize the Action field values.

Resources