Show dynamic number of rows using Variables #1080
Replies: 3 comments 6 replies
-
I assume that you are using a table.
But unless there is a special reason against it, you should use a filter on the table item instead. |
Beta Was this translation helpful? Give feedback.
-
Why are you using a grid for something that is based on a dynamic condition? Grids are designed to be static. If you know there are a static number of rows in your grid, its easier to use a scripted data set with a simple counter, and a visibility expression and a running count aggregation to achieve this. Either way, you can use this example to illustrate how to use the report context to set a global variable. I've included the table method as described. I've also included an example using a Grid. This will set a global variable in the onPrepare script event for the grid. Then, using a Dynamic Text element, it will display the result of the global variable. In the Visibility expression for each row in the grid, I am setting a variable to either true or false (simulating whatever you are using for logic to dynamically hide or show those rows), then checking if that variable is set, if it is false (meaning show the row), getting the global variable, increasing it, then resetting it in the global context. |
Beta Was this translation helpful? Give feedback.
-
This is not related to your original questions, but the Javascript in your visibility expression seems to contain errors. Are you aware that The operands are comparisons, so they are boolean, and the result is the same in this special case, but this still is a programming error. |
Beta Was this translation helpful? Give feedback.
-
Situation is want to show the correct running number when there is situation that some row will be hidden.
I got the below suggestion to use variables but not sure how exact to create it into BIRT.
vars["GridRownumber"]
if(conditiontoshowpreviousGridRow){vars["GridRownumber"]=vars["GridRownumber"]+1;}
Q1: The variables that create, do I need to put in any default value
Q2: How to put this javascript for this "conditiontoshowpreviousGridRow".
Thanks in advance
Beta Was this translation helpful? Give feedback.
All reactions