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

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.

Related

Tableau text table zero records

I am using the text table option to visualize a KPI on Tableau Dashboard (one figure visualization).
I have a filter on , and occasionally the filter will filter out all underlying record.
Is there an option to have the text tablev visualise an alternative text or "none" instead of just becoming just blank?
Yes, if the field you're using is a dimension, you can simply right-click it on the value or on the fields window (to the left) and select "Edit aliases...", changing the 'null' alias to whatever you want.
If the field is a measure (numeric value), you will have to create a calculated field with a structure like:
IF [Field] = NULL
THEN "Field is empty"
ELSE STR([Field])
END
Once you're filtering out data, no data can be visualized and that's why you get the blank spot instead of your table/chart.
One way to bypass this problem could be building a dashboard with a tiled text object with "No data" and then you can put above it your worksheet in floating mode.
Try to see something really similar here.

Qlikview selection to work on multiple fields

I have three different tables that contain a similar field ('Department') meaning the possible values in each of them are exactly the same. I have a sheet that shows different objects let's say charts, line graphs, straight table etc based on table 1, 2 or 3. Now because the tables are not directly connected, I can't just have a listbox that selects works on all of them for that column. I want to have a single selection like a listbox based on one of them but a selection is made is like show me all possible values where
Field A = Field B = Field C and on deselect i want to have the same behaviour
Probably I will have to use macros but I am not finding any good guidance.
For this case you can use the set analysis p() function.
For example if your fields are named Department and Department1. Then you have have your listbox based on Department field and in the charts where is needed Department1 selection you can write expression like this:
sum( {< Department1 = p( Department ) >} Value)
This will show sum( Value ) where selected/possible values in Department are equal to Department1
As of the macros - they should be your really, really final solution and try to avoid them. They dont work on 100% when the document is published on the server and they are single threaded, which can lead to performance issues with your app.

How to set focus on a particular row in a TDBgrid Delphi

I want to set the focus on a specific row on a Tdbgridview.
First, I choose the criteria field ( column concerned by search ex: FisrtName) from a combo box then I type criteria in a TeditField (ex : Jack ).
Then the arrow of the Dbgrifd should point on the concerned row.
How should I do?
thanks.
The TDBGrid component (and all other TDBxxx components as well) are what Delphi defines as dataware components. This kind of component exists as a visual expression of a dataset.
So, in a TDBGrid you should not think about focusing a row of the grid, rather think about positioning a row of the grid's dataset (using the Locate method suggested by TLama, for instance). The grid will notice that the current row of its dataset has changed (because the grid is aware about the condition of the dataset) and will focus the corresponding row.
Update 1
Below you can see an example of what I said:
MyDataset.Locate('Id', 123, []);
The code above simply looks for a certain record in a dataset named MyDataset. The first parameter is the name of a existing field in the dataset. So, you have a dataset with some fields and one of those is named Id. The second parameter is the value contained in that field in the desired row and the third parameter is some options that do not apply here. Go to the Delphi docwiki for more details on the Locate method.
In other words, we are looking for a row in which the field Id has the value 123! If the dataset can find such a row, it will become the current record (or row). If there is a TDBGrid connected to a TDataSource that is connected to TMyDataset, it will automatically update to select the corresponding row, just like you wanted.

Summing values in repeated sections in Orbeon

I have a problem when it comes to suming values from a repeated section. Specifically, when I have a repeated section in the orbeon builder with a control that has a value I can easily sum the values of these sections in a different control using sum($control-1) - in the calculated value. When inputing values in the form preview the sum is correct in my control with the summed value.
Unfortunately, when I add a section using the +Insert Below button in the form preview while testing the form the sum() function doesn't work anymore. In the control with this calculated value nothing is shown. Is there a different way to get the sum of values from repeated sections or is this a bug in orbeon?
Once you add a new section while testing the form the sum() function doesn't work anymore, because it adds a empty element to the node-set.
In XPath, when using the sum function, the value of each node is determined by trying to converting it to a number (number()), if there is a empty value, it's gonna convert to NaN, thus in the control with this calculated value nothing is shown by Orbeon.
A different way that would work would be to use the expression like: sum($control-1[text()]) . This way you are testing if the node has content before trying to sum it, so it's always gonna work.

Multiple field values to subreport error

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.

Resources