Home
Analytics
Highlight rules
JulieZ
I want to highlight rows in a table based on multiple conditions to consider at the same time. For example,
if (a>=50 and b<=50) make the font color red;
else if (a<30 and b>30) make the font color blue
Is there any way to do this? Thanks!
- Julie
Find more posts tagged with
Comments
pricher
Julie,
Click on the row in the table, then go to the Highlights section of the Property Editor. In that section, enter your conditions and the formatting for your condition.
P.
JulieZ
The problem is I can't enter two conditions at the same time in the highlight section as I mentioned something like "if (a>=50 and b<=50)". It only gives me only one field. Any other idea?
Thanks,
Julie
mwilliams
Hi Julie,
You can write an expression like:
(a >= 50) && (b <= 50)
And use the function:
Is True
Hope this helps.
JulieZ
Hi Michael,
Thanks! It works great - I should pay attention to the options in the dropdown box. At the same time, I found another solution that I can put some scripts in onCreate event for the detail row to access the row object. But I like your solution which is more straightforward.
Thanks,
Julie
mwilliams
Julie,
No problem. Glad to help. Let us know whenever you have questions!
hirenshah
Is it possible to apply highlight condition based on value from other data set(another table)?
Thanks
Hiren
mwilliams
Hi Hiren,
Can you explain this a little bit further?
hirenshah
Hi,
Example:
I have TABLE_1 with column A, column B
And I have TABLE_2 with column Threshold. And this table has only one row.
Now I want to highlight (color) cells of column A in TABLE_1 based on Threshold value in TABLE_2.
So my condition will be something like:
row["A"] <= TABLE_2:row["Threshold"]
Hiren
mwilliams
Hiren,
In your onFetch of your "threshold" dataSet, you should be able to capture the value in a variable of some sort. Then, you should be able to use this variable to compare your value from the other dataSet to. Let me know if you have any questions.
Hope this helps.
hirenshah
Michael,
Thanks for your help.
Can you please explain me in detail.
I dont know how can I capture value in parameter.
Hiren
mwilliams
Hiren,
What version of BIRT are you using? I'll make a quick example.
hirenshah
BIRT version is 2.3.0
And if you dont mine I also have one more question,
My report is generating two different dataset (using two different queries).
Is it possible to run two queries in parallel?
Thanks for your help
mwilliams
Hiren,
Take a look at this report design. There is script in the "initialize" of the report, the "onFetch" of the dataSet, and a highlight rule on the detail row. The hidden text box is bound to the dataSet with the "threshold" in it so that the dataSet is run and the variable is set. Otherwise, it doesn't work.
hirenshah
Hi Michael,
It is working. I learned something new.
Thank you for your help.
I have one last question for you.
In you example TestReport, there are two data-sets each with some SQL query.
I am also having two dat-sets but instead of SQL query I have perl scripts.
Currently birt will sequentially run first data_set (internally perl script) and then data_set_1 (internally perl script).
Is it possible two run both data-sets (both perl script) in parallel ??
Currently my report is slow to make it more fast I want my internally scripts to run in parallel.
Regards,
Hiren
mwilliams
Hiren,
I don't know if there's any way to force this to happen differently. If I find anything different on this subject, I'll let you know.
Marock
Hello everybody !
I want to highlight a table rows's background once every two rows.
I used this condition : (row[0]%2) Equal to 1 , But it doesn't work !
Should I change the parameter of row[?] ?
Thank you
mwilliams
The the condition row.__rownum%2 equal to 1
rharris59
<p>Michael,</p>
<p>I'm wanting to highlight rows for dates that represent weekends (Sat, Sun).</p>
<p>Have you or do you know if anyone has written a script to take a 'date', determine if the date is a Sat or Sun?</p>
Clement Wong
<p>There is a built-in BIRT function, BirtDateTime.weekDay( date [, integer]) that takes a date and returns an integer representing the day. The second argument is optional and the various options are explained in this reference (@ <a data-ipb='nomediaparse' href='
http://help.eclipse.org/mars/index.jsp?topic=/org.eclipse.birt.doc/birt/ScriptingReference.24.4.html).'>http://help.eclipse.org/mars/index.jsp?topic=/org.eclipse.birt.doc/birt/ScriptingReference.24.4.html).</a><br>
;
</p>
swatisharma
<p>hi</p>
<p>i am facing a problem where in my report the highlight is not in a sequence, my report has three tables and a grid. and in the report the highlight is breaking in between. why is that? please help me in solving this problem</p>
<p> </p>
<p>Thanks</p>
<p>Swati</p>
Clement Wong
<p>Swati,</p>
<p> </p>
<p>What version of BIRT are you using? Commercial, or OS BIRT?</p>
<p> </p>
<p>What is the layout of your report? In sequence, Table1, Table2, Table3, and then a Grid? What highlight rules do you have? What sequence is it doing?</p>
<p> </p>
<p>To assist in troubleshooting, are you able to attach the .rptdesign, or replicate the issue with Classic Models and attach the design file?</p>
swatisharma
<p>Hi all </p>
<p> </p>
<p>I am trying to highlight the alternative rows, i am using the rule "<span style="color:rgb(40,40,40);font-family:'Source Sans Pro', sans-serif;">row.__rownum%2" it is working but the dont know why in the report the two rows are getting highlighted together. </span><span style="color:rgb(40,40,40);font-family:'Source Sans Pro', sans-serif;"> </span></p>
swatisharma
<p>my version is 4.5</p>
Clement Wong
<p>What does your report design layout look like? It is a simple table?</p>
<p> </p>
<p>Are you able to either attach you design (you can remove the data source since it may contain sensitive information), or if you can replicate it with a sample using the Classic Models database?</p>
swatisharma
<p>hi, </p>
<p>i am facing a problem with a report,where i am not able to highlight the report (alternative rows).</p>
<p> </p>
<p>The detailed error is:</p>
<div>org.eclipse.birt.report.engine.api.EngineException: A BIRT exception occurred. See next exception for more information. Can not convert the value of Cash and Cash Equivalents to Double type. at org.eclipse.birt.report.engine.executor.ExecutionContext.addException(ExecutionContext.java:1245) at </div>
<div> org.eclipse.birt.report.engine.executor.ExecutionContext.addException(ExecutionContext.java:1224) at org.eclipse.birt.report.engine.executor.DataItemExecutor.execute(DataItemExecutor.java:101) at org.eclipse.birt.report.engine.internal.executor.dup.SuppressDuplicateItemExecutor.execute(SuppressDuplicateItemExecutor.java:43) at </div>
<div> org.eclipse.birt.report.engine.internal.executor.wrap.WrappedReportItemExecutor.execute(WrappedReportItemExecutor.java:46) at org.eclipse.birt.report.engine.internal.executor.l18n.LocalizedReportItemExecutor.execute(LocalizedReportItemExecutor.java:34) at </div>
<div> org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:65) at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26) at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:140) at </div>
<div> org.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.resumeLayout(HTMLInlineStackingLM.java:111) at org.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.layoutNodes(HTMLInlineStackingLM.java:160) at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26) at </div>
<div> org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:140) at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:70) at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26) at </div>
<div> org.eclipse.birt.report.engine.layout.html.HTMLTableBandLM.layoutChildren(HTMLTableBandLM.java:67) at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:140) at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:70) at </div>
<div> org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26) at org.eclipse.birt.report.engine.layout.html.HTMLRepeatHeaderLM.layoutChildren(HTMLRepeatHeaderLM.java:46) at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:140) at </div>
<div> org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:70) at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26) at org.eclipse.birt.report.engine.layout.html.HTMLRepeatHeaderLM.layoutChildren(HTMLRepeatHeaderLM.java:46) at </div>
<div> org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:140) at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:70) at org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout(HTMLPageLM.java:92) at </div>
<div> org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutEngine.layout(HTMLReportLayoutEngine.java:100) at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun(RunAndRenderTask.java:181) at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run(RunAndRenderTask.java:77) at </div>
<div> org.eclipse.birt.report.service.ReportEngineService.runAndRenderReport(ReportEngineService.java:937) at org.eclipse.birt.report.service.BirtViewerReportService.runAndRenderReport(BirtViewerReportService.java:973) at </div>
<div> org.eclipse.birt.report.service.actionhandler.BirtRunAndRenderActionHandler.__execute(BirtRunAndRenderActionHandler.java:76) at org.eclipse.birt.report.service.actionhandler.AbstractBaseActionHandler.execute(AbstractBaseActionHandler.java:90) at </div>
<div> org.eclipse.birt.report.presentation.aggregation.layout.EngineFragment.doService(EngineFragment.java:318) at org.eclipse.birt.report.presentation.aggregation.AbstractBaseFragment.service(AbstractBaseFragment.java:76) at org.eclipse.birt.report.servlet.BirtEngineServlet.__doGet(BirtEngineServlet.java:116) at </div>
<div> org.eclipse.birt.report.servlet.BaseReportEngineServlet.doGet(BaseReportEngineServlet.java:185) at org.eclipse.birt.report.servlet.BaseReportEngineServlet.doPost(BaseReportEngineServlet.java:224) at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327) at </div>
<div> javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at org.eclipse.birt.report.servlet.BaseReportEngineServlet.service(BaseReportEngineServlet.java:116) at org.eclipse.equinox.http.registry.internal.ServletManager$ServletWrapper.service(ServletManager.java:180) at org.eclipse.equinox.http.servlet.internal.HttpServiceRuntimeImpl</div>
<div> $LegacyServlet.service(HttpServiceRuntimeImpl.java:1271) at org.eclipse.equinox.http.servlet.internal.registration.EndpointRegistration.service(EndpointRegistration.java:162) at org.eclipse.equinox.http.servlet.internal.servlet.ResponseStateHandler.processRequest(ResponseStateHandler.java:63) at </div>
<div> org.eclipse.equinox.http.servlet.internal.HttpServiceRuntimeImpl.doDispatch(HttpServiceRuntimeImpl.java:413) at org.eclipse.equinox.http.servlet.internal.HttpServiceRuntimeImpl.doDispatch(HttpServiceRuntimeImpl.java:341) at org.eclipse.equinox.http.servlet.internal.HttpServiceRuntimeImpl.doDispatch(HttpServiceRuntimeImpl.java:204) </div>
<div> at org.eclipse.equinox.http.servlet.internal.servlet.ProxyServlet.processAlias(ProxyServlet.java:91) at org.eclipse.equinox.http.servlet.internal.servlet.ProxyServlet.service(ProxyServlet.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at org.eclipse.equinox.http.jetty.internal.HttpServerManager</div>
<div> $InternalHttpServiceServlet.service(HttpServerManager.java:356) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:808) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:587) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:221) at </div>
<div> org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061) at </div>
<div> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) at org.eclipse.jetty.server.Server.handle(Server.java:497) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310) at </div>
<div> org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257) at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635) at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555) at </div>
<div> java.lang.Thread.run(Unknown Source) Caused by: org.eclipse.birt.data.engine.core.DataException: A BIRT exception occurred. See next exception for more information. Can not convert the value of Cash and Cash Equivalents to Double type. at org.eclipse.birt.data.engine.core.DataException.wrap(DataException.java:123) at </div>
<div> org.eclipse.birt.data.aggregation.calculator.StringCalculator.toDouble(StringCalculator.java:140) at org.eclipse.birt.data.aggregation.calculator.StringCalculator.convert(StringCalculator.java:108) at org.eclipse.birt.data.aggregation.calculator.StringCalculator.add(StringCalculator.java:39) at org.eclipse.birt.data.aggregation.impl.TotalSum</div>
<div> $MyAccumulator.onRow(TotalSum.java:116) at org.eclipse.birt.data.engine.executor.aggregation.AggregationHelper.onRow(AggregationHelper.java:365) at org.eclipse.birt.data.engine.executor.aggregation.AggregationHelper.pass(AggregationHelper.java:192) at </div>
<div> org.eclipse.birt.data.engine.executor.aggregation.AggregationHelper.calculate(AggregationHelper.java:155) at org.eclipse.birt.data.engine.executor.aggregation.AggregationHelper.populateAggregations(AggregationHelper.java:110) at org.eclipse.birt.data.engine.executor.aggregation.AggregationHelper.<init>(AggregationHelper.java:86) </div>
<div> at org.eclipse.birt.data.engine.executor.transform.pass.ResultSetProcessUtil.populateAggregationInBinding(ResultSetProcessUtil.java:254) at org.eclipse.birt.data.engine.executor.transform.pass.ResultSetProcessUtil.populateAggregation(ResultSetProcessUtil.java:221) at </div>
<div> org.eclipse.birt.data.engine.executor.transform.pass.ResultSetProcessUtil.populateResultSet(ResultSetProcessUtil.java:177) at org.eclipse.birt.data.engine.executor.transform.pass.ResultSetProcessUtil.doPopulate(ResultSetProcessUtil.java:95) at </div>
<div> org.eclipse.birt.data.engine.executor.transform.pass.PassManager.prepareQueryResultSet(PassManager.java:108) at org.eclipse.birt.data.engine.executor.transform.pass.PassManager.pass(PassManager.java:135) at org.eclipse.birt.data.engine.executor.transform.pass.PassManager.populateResultSet(PassManager.java:74) at </div>
<div> org.eclipse.birt.data.engine.executor.transform.ResultSetPopulator.populateResultSet(ResultSetPopulator.java:218) at org.eclipse.birt.data.engine.executor.transform.CachedResultSet.<init>(CachedResultSet.java:200) at org.eclipse.birt.data.engine.executor.CandidateQuery.execute(CandidateQuery.java:142) at </div>
<div> org.eclipse.birt.data.engine.impl.PreparedScriptDSQuery$ScriptDSQueryExecutor.executeOdiQuery(PreparedScriptDSQuery.java:226) at org.eclipse.birt.data.engine.impl.QueryExecutor.execute(QueryExecutor.java:1251) at org.eclipse.birt.data.engine.impl.ServiceForQueryResults.executeQuery(ServiceForQueryResults.java:233) at </div>
<div> org.eclipse.birt.data.engine.impl.QueryResults.getResultIterator(QueryResults.java:178) at org.eclipse.birt.report.engine.data.dte.QueryResultSet.<init>(QueryResultSet.java:98) at org.eclipse.birt.report.engine.data.dte.DteDataEngine.doExecuteQuery(DteDataEngine.java:168) at </div>
<div> org.eclipse.birt.report.engine.data.dte.AbstractDataEngine.execute(AbstractDataEngine.java:285) at org.eclipse.birt.report.engine.executor.ExecutionContext.executeQuery(ExecutionContext.java:1947) at org.eclipse.birt.report.engine.executor.QueryItemExecutor.executeQuery(QueryItemExecutor.java:80) at </div>
<div> org.eclipse.birt.report.engine.executor.TableItemExecutor.execute(TableItemExecutor.java:62) at org.eclipse.birt.report.engine.internal.executor.dup.SuppressDuplicateItemExecutor.execute(SuppressDuplicateItemExecutor.java:43) at </div>
<div> org.eclipse.birt.report.engine.internal.executor.wrap.WrappedReportItemExecutor.execute(WrappedReportItemExecutor.java:46) at org.eclipse.birt.report.engine.internal.executor.l18n.LocalizedReportItemExecutor.execute(LocalizedReportItemExecutor.java:34) at </div>
<div> org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:65) ... 44 more Caused by: org.eclipse.birt.core.exception.CoreException: Can not convert the value of Cash and Cash Equivalents to Double type. ... 77 more</div>
<div> </div>
<div>i am also sending my xml source, where i am getting the error../</div>
<div> </div>
<div>
<div> **this line is where i am getting the error)<data id="2199"></div>
<div> <property name="fontFamily">"AvenirNext LT Com Cn"</property></div>
<div> <property name="fontWeight">bold</property></div>
<div> <property name="paddingTop">2pt</property></div>
<div> <property name="paddingBottom">3pt</property></div>
<div> <property name="textAlign">right</property></div>
<div> <property name="resultSetColumn">Aggregation_1</property></div>
<div> </data></div>
<div> </cell></div>
<div> <cell id="1616"></div>
<div> <data id="2200"></div>
<div> <property name="fontFamily">"AvenirNext LT Com Cn"</property></div>
<div> <property name="fontWeight">bold</property></div>
<div> <property name="paddingTop">2pt</property></div>
<div> <property name="paddingBottom">3pt</property></div>
<div> <property name="textAlign">right</property></div>
<div> <property name="resultSetColumn">Aggregation_3</property></div>
<div> </data></div>
<div> </cell></div>
<div> <cell id="1617"/></div>
<div> <cell id="1618"></div>
<div> <data id="2202"></div>
<div> <property name="fontFamily">"AvenirNext LT Com Cn"</property></div>
<div> <property name="fontWeight">bold</property></div>
<div> <property name="paddingTop">2pt</property></div>
<div> <property name="paddingBottom">3pt</property></div>
<div> <property name="textAlign">right</property></div>
</div>
Clement Wong
<p>We'll need to see what you have defined for "Cash and Cash Equivalents" in the data binding, and where it's being used.</p>
<p> </p>
<p>Please attach the design. You can remove the Data Source if there is are credentials, host names, etc...</p>
<p> </p>
<p>Or if you cannot attach the design, please replicate it with the Classic Models sample database, and attach that instead.</p>
swatisharma
<p>My problem is resolved,thanks for your help.
</p>
swatisharma
<p>Hi</p>
<p> </p>
<p>My report is not giving any error but the highligt is no happening at all, i want highlight the alternative row.the condition that i am using in my report is: row["groupRow"]% 2 Not Equal to 0. what should i do.</p>
Clement Wong
<p>Please attach the design. You can remove the Data Source if there is are credentials, host names, etc...</p>
<p> </p>
<p>Or if you cannot attach the design, please replicate it with the Classic Models sample database, and attach that instead.</p>