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)
Setting Formats for content in a table i.e. Date,String and Number formats
ravi11
<p>Greetings,</p><p> </p><p>Hi, I am actually using birt engine api and writing java classes to generate a rptdesign.</p><p> </p><p>Now I am facing problem to add formats such as date,string and integer formats for data in a column for table detail.</p><p> </p><p>But I am unable to do that,where as I am sucessfull in setting up font size,alignment for a table detail using <strong>setProperty</strong> method.</p><p> </p><p>Please help me in setting up a format for a table detail value. I am adding the code which i tried to set the formats for table detail.</p><p> </p><p><strong>Code:</strong></p><p>DataItemHandle data = reportDesignHandle.getElementFactory().newDataItem("nameData");</p><p>data.<strong>setProperty</strong>(StyleHandle.STRING_FORMAT_PROP, DesignChoiceConstants.STRING_FORMAT_TYPE_UPPERCASE);</p><p> </p><p>Thanks in advance.</p>
Find more posts tagged with
Comments
ravi11
<p>Hi,</p><p> </p><p>I have tried to solve this issue posted by me. The below mentioned code is doing the trick here.</p><p> </p><p>DataItemHandle data = reportDesignHandle.getElementFactory().newDataItem("nameData");</p><p> </p><p>HighlightRule rule3 = StructureFactory.createHighlightRule();
IHighlightRule irule3 = new HighlightRuleImpl(rule3);
irule3.setOperator("is not null");
irule3.setTestExpression("row");
irule3.setStringFormat(DesignChoiceConstants.STRING_FORMAT_TYPE_LOWERCASE); // to change the table content to lower case
data.getPropertyHandle("highlightRules").addItem(rule3); // add the highlight rule to the content</p><p> </p><p>Thanks,</p><p>Ravi.</p>
ravi11
<p>Hi,</p><p> </p><p>The actual setting of formats are done using the below code,which works in all cases.</p><p> </p><p>Code:</p><p> DataItemHandle data = reportDesignHandle.getElementFactory().newDataItem("nameData");</p><p> </p><p> StringFormatValue stringFormatValue = new StringFormatValue();
stringFormatValue.setCategory(DesignChoiceConstants.STRING_FORMAT_TYPE_UPPERCASE);
stringFormatValue.setPattern(DesignChoiceConstants.STRING_FORMAT_TYPE_UPPERCASE);
data.setProperty(StyleHandle.STRING_FORMAT_PROP, stringFormatValue);</p><p> </p><p> DateTimeFormatValue dateTimeFormatValue = new DateTimeFormatValue();
dateTimeFormatValue.setCategory(DesignChoiceConstants.DATE_FORMAT_TYPE_SHORT_DATE);
dateTimeFormatValue.setPattern(DesignChoiceConstants.DATE_FORMAT_TYPE_SHORT_DATE);
data.setProperty(StyleHandle.DATE_TIME_FORMAT_PROP, dateTimeFormatValue);</p><p> </p><p>Hope you guys find this useful
</p>