Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Null String Breaking row
ziadali
<p>Hi all,</p>
<p> </p>
<p>i'm developing a report using birt but having some trouble, as am new to this tool.</p>
<p> </p>
<p>I got a table, and inside that a value comming from the database.</p>
<p> </p>
<p>+
+</p>
<p>| Table |</p>
<p>+
+</p>
<p>| value |</p>
<p>|______|</p>
<p> </p>
<p>i retrieve that value inside a <expression name="expression"></p>
<p>using, for example: dataSetRow["text"]</p>
<p> </p>
<p>the problem is, the expression return 2 lines of values..</p>
<p>The first one always is a null String and it´s breaking line.</p>
<p> </p>
<p>The visual becames that (example):</p>
<p> </p>
<p>+
+</p>
<p>| Name |</p>
<p>+
+</p>
<p>| |</p>
<p>|_ Joe _|</p>
<p> </p>
<p>instead of:</p>
<p> </p>
<p>+
+</p>
<p>| Name |</p>
<p>+
+</p>
<p>| Joe |</p>
<p>|______|</p>
<p> </p>
<p>How can i fix that?</p>
Find more posts tagged with
Comments
GLO_FR
<p>Hi,</p>
<p> </p>
<p>why didn't put a filter inside your query ? </p>
<p>like</p>
<pre class="_prettyXprint">
WHERE mycolunm != null</pre>
<p>or </p>
<pre class="_prettyXprint">
WHERE mycolunm not isnull</pre>
<p>BTW, you can also put this kind of filter inside the report directly on the table</p>
<p>.</p>
ziadali
<blockquote class="ipsBlockquote" data-author="GLO_FR" data-cid="130013" data-time="1407418451">
<div>
<p>Hi,</p>
<p> </p>
<p>why didn't put a filter inside your query ? </p>
<p>like</p>
<pre class="_prettyXprint">
WHERE mycolunm != null</pre>
<p>or </p>
<pre class="_prettyXprint">
WHERE mycolunm not isnull</pre>
<p>BTW, you can also put this kind of filter inside the report directly on the table</p>
<p>.</p>
</div>
</blockquote>
<p> </p>
<p>Hi, thanks for answering.</p>
<p>In my case is a little bit different.</p>
<p>I can't change the query and put "where" clause..</p>
<p>i can only modify the report, and there has the following:</p>
<p> </p>
<p>ex:</p>
<p> </p>
<p>var purchRequis = purchaseRequisitionList.get(currentRowPurchRequis);</p>
<p> </p>
<p>and then:</p>
<p>row["text"] = purchRequis.getText();</p>
<p> </p>
<p>this ' row["text"] ' returns:</p>
<p> </p>
<p>""</p>
<p>"joe"</p>
<p> </p>
<p>but if i put a condition in the expression like this</p>
<p> </p>
<p>if (dataSetRow["text"] == "" )</p>
<p> </p>
<p>it will break the line anyway, because this field is inside a table with other cells.</p>
<p> </p>
<p>is it too confuse?</p>
GLO_FR
<blockquote class="ipsBlockquote" data-author="ziadali" data-cid="130015" data-time="1407420263">
<div>
<p><span style="font-size:12px;">is it too confuse?</span></p>
</div>
</blockquote>
<p>a little ^_^</p>
<p> </p>
<p>Can you upload your design with a flatFile example ?</p>
ziadali
<blockquote class="ipsBlockquote" data-author="GLO_FR" data-cid="130016" data-time="1407421103">
<div>
<p>a little ^_^</p>
<p> </p>
<p>Can you upload your design with a flatFile example ?</p>
</div>
</blockquote>
<p> </p>
<p>hahaha, sorry about that</p>
<p> </p>
<p>I have attached my .rptdesign, i'm using 2.3.2 version of birt.</p>
<p> </p>
<p>Also attached a image so you can understand what i'm saying..</p>
<p> </p>
<p>in the file you can search by:</p>
<p>row["text"] = purchRequis.getText();</p>
<p> </p>
<p>that's where is comming with a first line blank.</p>
GLO_FR
<p>Hi,</p>
<p> </p>
<p>can you upload a flatfile (with the "error" or the null value) of the <strong>PurchaseRequisitionDataSet </strong>just to see how it looks like ?</p>
ziadali
<p>Hi
@GLO_FR
, i'm sorry but what is a flat file? (i'm completly new to birt)</p>
<p> </p>
<p>in my eclipse project i'm seeing the .rptdesign and .xml file.</p>
GLO_FR
<p>By flat file, I mean an extraction of <span style="color:#282828;"><span style="font-family:'Source Sans Pro', sans-serif;"><span style="font-size:14px;">the </span></span></span><strong>PurchaseRequisitionDataSet </strong>in csv or txt format</p>
ziadali
<p>Hi, thanks for your help. I ended up solving the issue.<br>
That blank first line wasn't a birt layout issue, was coming from the logic that pulled from the database.</p>
<p> </p>
<p>But i have another question, if you please could help me again:</p>
<p> </p>
<p>in my report i got the datasetrows like:</p>
<p> </p>
<p>datasetrow["text"]</p>
<p>datasetrow["customer"]</p>
<p> </p>
<p>how can i use those values inside of the master-page?</p>
<p> </p>
<p><page-setup></p>
<p><simple-master-page name="Simple MasterPage" id="2"></p>
<p> "datasetrow value in here"?</p>
<p></simple-master-page><br>
</page-setup></p>
pricher
<p>Hi,</p>
<p> </p>
<p>You <strong><em>can </em></strong>drag and drop a column from a data set into the header or footer section of the master page. However, you will only get the value from the first row of your query.</p>
<p> </p>
<p>I am not sure what you are trying to accomplish and there are other ways of displaying dynamic data on a master page. The following video might help you understand the concept of page variables:
https://www.youtube.com/watch?v=lw_k1qHY_gU&list=UUcqqPlXBTUcA8Hw1QmT2WMw</p>
<p> </p>
<p>If you can be a bit more specific about what you need to create, please share with us.</p>
<p> </p>
<p>Regards,</p>
<p> </p>
<p>P.</p>
ziadali
<p>Hi
@pricher
, thanks for answer.</p>
<p> </p>
<p>I saw your video but i don't have the "Variables" in the Data Explorer. See the atached, please;</p>
<p> </p>
<p>What i'm trying to do is kind of what you did in the video. Example: Get the customer name and put in the footer.</p>
<p> </p>
<p>I tried to put a data in the master-page but not working, also tried globalvariable:</p>
<pre class="_prettyXprint _lang-xml">
<page-setup>
<simple-master-page name="Simple MasterPage" id="2">
<page-footer>
<grid id="8115">
<property name="width">100%</property>
<list-property name="boundDataColumns">
<structure>
<property name="name">itemGlobal</property>
<expression name="expression">reportContext.getPersistentGlobalVariable("itemglobal");</expression>
<property name="dataType">string</property>
</structure>
<structure>
<property name="name">item</property>
<property name="displayName">item</property>
<expression name="expression">dataSetRow["item"]</expression>
<property name="dataType">string</property>
</structure>
</list-property>
...
</pre>
<p>Ps: i'm using 2.3.2 version of birt and have attached the .rptdesign if could take a look, please.</p>
pricher
<p>Hi,</p>
<p> </p>
<p>Sorry, I didn't realize you were using an older version of BIRT; page variables were introduced after 2.3.2....</p>
<p> </p>
<p>If you want to display something from a persistent global variable in your master page, you can add script to the <em>onRender </em>method of a label:</p>
<p> </p>
<p><span style="font-family:'courier new', courier, monospace;">this.text = reportContext.getPersistentGlobalVariable("itemglobal")</span></p>
<p> </p>
<p>Hope this helps,</p>
<p> </p>
<p>P.</p>
ziadali
<p>
@pricher<
;/p>
<p> </p>
<p>i tried that way:</p>
<pre class="_prettyXprint _lang-xml">
<page-footer>
<grid id="8099">
<property name="width">100%</property>
<column id="8100"/>
<row id="8101">
<cell id="8102">
<text id="8104">
<method name="onRender"><![CDATA[this.text = reportContext.getPersistentGlobalVariable("itemglobal");]]></method>
</text>
<label id="8103">
<method name="onRender"><![CDATA[this.text = reportContext.getPersistentGlobalVariable("itemglobal");]]></method>
</label>
</cell>
</row>
</grid>
</page-footer>
</pre>
<p>But nothing shows on the report. Am i doing wrong?</p>
pricher
<p>It should work. Put some text in front of the reportContext call. Something like:</p>
<p> </p>
<p>this.text = "my value=" + reportContext.getPersistentGlobalVariable("itemglobal");</p>
<p> </p>
<p>I have the feeling your global variable is null.</p>
<p> </p>
<p>P.</p>
ziadali
<p>
@pricher<
;/p>
<p> </p>
<p>yeah, "my value" shows.</p>
<p>When i set a fix value for this globalvariable in the method: <initialize> it works.</p>
<p> </p>
<p>But the value i want to save is inside this method: <method name="fetch"></p>
<p>where it cames from the database, like: row["item"]</p>
<p>So i set the global variable inside this method -> fetch.. but onrender of the label, the variable is null</p>
<p> </p>
<p>Is there a alternative to workaround?</p>
pricher
<p>Hi,</p>
<p> </p>
<p>There's no reason why it shouldn't work in the <em>fetch </em>method of a data set. Unfortunately, I do not know of a workaround apart from page variables, but they are not available in the version of BIRT you are using. Any possibilities of going to a newer version?</p>
<p> </p>
<p>Regards,</p>
<p> </p>
<p>P.</p>