pallavig026 Posted January 9, 2019 Share Posted January 9, 2019 Hi,Each month we need to change the date in JRXML file manually as 14.11,14,12 etc.How can i automate this feature? Like code will read the current system date, once it reaches 14th of the month , automatically the date will change in jrxml file as well?Please help.Below is the code snippet<staticText> <reportElement key="staticText-2" mode="Opaque" x="381" y="242" width="79" height="18" forecolor="#000000" backcolor="#FFFFFF" uuid="4ec23e25-c8d9-4941-bd81-777aff6c08a7"/><box> <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#FFFFFF"/> </box> <textElement textAlignment="Left" verticalAlignment="Top" rotation="None"> <font fontName="Arial" size="10" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false"/> <paragraph lineSpacing="Single"/> </textElement> <text><![CDATA[14.01.2019]]></text> ----->>>> This should be automated. The date should change according to the system date. Every month once the date hits 14 it should change in file too. </staticText> Link to comment Share on other sites More sharing options...
pallavig026 Posted January 9, 2019 Author Share Posted January 9, 2019 Hi Again,I have changed the static field to dynamic field like below.<textField> <reportElement key="staticText-2" mode="Opaque" x="381" y="242" width="79" height="18" forecolor="#000000" backcolor="#FFFFFF" uuid="f6141550-bf19-4cf2-be66-ba676a3be639"/> <box><topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#FFFFFF"/> </box> <textElement textAlignment="Left" verticalAlignment="Top" rotation="None"> <font fontName="Arial" size="10" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false"/> <paragraph lineSpacing="Single"/> </textElement> <textFieldExpression><![CDATA[new SimpleDateFormat("dd/MM/yy").format(new Date())]]></textFieldExpression> </textField>But my report will run on every month end, So after the month completed report should show next month 14 as date. can you please help ? Link to comment Share on other sites More sharing options...
narcism Posted January 9, 2019 Share Posted January 9, 2019 Linking this question to the same one on stackoverflow:https://stackoverflow.com/questions/54104693/dynamic-content-in-text-field-in-jrxml-file Link to comment Share on other sites More sharing options...
pallavig026 Posted January 10, 2019 Author Share Posted January 10, 2019 Hi, Thank you so much for the answer. But when i tried to execute this code its showing the date as "14/12/2018". But i want to show next month date. Like current month is Jan , so i should display 14.02.2019. Requirement is: From Jan 1 to Jan 30 the date should display as Feb 14 (14.02.2019), And for Feb1 to Feb 28 the date should display as 14.03.2019. Its like for the current month we should display next month 14.mm.yyyy as the date. Link to comment Share on other sites More sharing options...
pallavig026 Posted January 10, 2019 Author Share Posted January 10, 2019 Hi Again, Requirement got changed from client side. I need to use the "accounting date " field in the report (which is nothing but the current date). And that parameter is declared as follows: <parameter name="AccountingDate" class="java.sql.Timestamp" isForPrompting="false"> <defaultValueExpression><![CDATA[bdw.reportmanager.HPDFormatter.getTimestamp("2006", "1", "31")]]></defaultValueExpression> </parameter> So how can i make use this "Accounting date" and display next month date? NOTE: accounting date is nothing but the current date. IT would be great if u can please help. Thank you Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now