Hide Block 1 based on user input and adjust the relative positioning of other blocks so that no empty space is there when the Block 1 is hidden.
Hiding concept I have taken from http://www.dagira.com/2007/07/31/alerters-on-charts-part-ii/. I would really like to thank Dave for providing such wonderful articles. I have taken eFashion universe for demonstration purpose. 1st requirement is to hide block 1 based on user input and then we need to position the remaining blocks relatevely so that we don’t see any empty space when the block 1 is hidden.
Here we will show Block 1 if user enters “Miami” for city object otherwise we will hide it.
1. Create a report with three blocks as shown:
2. Create a variable with the formula:
=If UserResponse([City];”Enter City:”) = “Miami” Then 1 Else 0
3. Select the first block and apply the block filter as:
Test = 1
4. Select the 1st block and go to the properties tab. Uncheck the option “Show when empty”.
5. Go to Edit query and drag City object in the filter panel and select equal to prompt.
6. Run the report with City = “Miami”. The report will be like:
7. And for any other city it will be like:
8. The first block is not showing now. One objective is met. Now the second thing is we need to utilize the space that is left above the 2nd block when 1st block is hidden.
9.Now select the 2nd Block and click on relative position option as shown:
10. Enter following values:
11. Now select the 3rd block and repeat the process. Note that 2nd block is set relative to 1st block and 3rd block is set relative to 2nd.
12. Run the report with City = “Miami”. The report will look like:
13. Now run with some other value of City. The report will be like:
Thus we are able to hide Block 1 based on user input (City <> Miami in our case). Also the relative positioning of blocks is adjusted so that we do not have any empty space when the Block 1 is hidden.