You are on page 1of 6

All in an input control

6 Comments/ in Web Intelligence / by McH APRIL 9, 2012

In my previous post I showed how to display all in a WebI report when the all value is selected in a drill filter. This blog will discuss almost the same. The only difference now is that the all value is selected in an input control. Lets create a simple report on top of the eFashion universe, selecting Year, Lines and Sales revenue objects. I will include also a query filter applied on the Lines dimension selecting only first 4 values so there are not too many records to play with:

I will create a simple table with all 3 objects as well as a new input control a multi-values check box assigned to the Lines dimension:

Since an input control is not a drill filter, the DrillFilter() function cannot be used to show selected values in a report. An input control works as a report filter so the ReportFilter()function is needed instead. However, the ReportFilter() function returns all selected values separated by a semicolon. If an input control contains many items (because there are many distinct values of a dimension where the input control was assigned) then the result can be a very long string:

To replace the above long string with an All Lines value, a formula needs to check what values are selected in the input control and whether those values that are selected are all that can be selected. The easiest way how to achieve it is to count the number of items in the Lines dimension and compare it to the same count when no filter is applied. So the formula will look like this:

=If NoFilter(Count([Lines])) = Count([Lines]) Then "All Lines"

Else ReportFilter([Lines])

The formula works as expected when all values are selected in the input control. But it can still provides a long result when many (but not all) values are selected. To fix this, the semicolons in the string can be replaced with the Line Feed character so every value is displayed in a new row:

=If NoFilter(Count([Lines])) = Count([Lines]) Then "All Lines"

Else Replace(ReportFilter([Lines]);";";Char(10))

Conclusion
Various WebI functions were combined in a formula that shows in a cell values selected in an input control:

NoFilter() ignores all filters when values are calculated Count() gives the number of items/values in a dimension Replace() replaces a part of a string with another string ReportFilter() gives values of a report filter applied to a dimension

All in a drill filter


0 Comments/ in Web Intelligence / by McH MARCH 29, 2012

Drill filters are an excellent way how to make WebI reports more interactive to users. However, the All value in a drill filter can sometimes cause problems.

If a WebI report with drill filters was used only by a WebI user then everything would be almost without a problem. However, reports need to be either printed or exported into XLS/PDF format very often. In such case its nice to print also values of drill filters so its obvious from a simple look at the printed/exported report what the report is actually showing.

Drill filters and their values are not printed nor exported. Their values need to be added into the report. For that reason there is the DrillFilters(object) function. It returns a value selected in a drill filter:

In the picture above, the drill filter is applied on the [Lines] dimension and the value Jackets is selected. The cell that shows Jackets in bold is the result of the formula shown in the rectangle.

When the value of the drill filter is changed to anything but All lines, the value in the cell reflects the selection. However, it stops working when All lines is selected. The cell with the formula becomes blank:

There is an easy way how to fix the formula though. The fix utilizes a fact that when All is selected in a drill filter then DrillFilters() function returns a string with a zero length. This can be tested in an IF statement and the result of the formula returned accordingly. So the final formula would look like this:

=If Length(DrillFilters([Lines])) = 0 Then "All Lines"

Else DrillFilters([Lines])

http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/d01bb7c7-048d-2b10-f2beef8eb45fb9f5&overridelayout=true

You might also like