Renier
Renier

Reputation: 1830

How do I set a property using javascript In Birt Reporting

I am using Birt Reporting and eclipse.

I have a report that I want to use a barcode in.

The test report that I made is a simple report with a barcode. enter image description here

It has the following properties "Barcode Content" is the property that will be displayed when you scan it : enter image description here

So currently if I scan it its "rrrrrrr"

I want to change this when the report generates with java script so I want to set the property "Barcode Content".

  1. How do I set the property.
  2. Where do you put the java script in the element ? (onPrepare,onCreate,onRender)

Upvotes: 0

Views: 1405

Answers (1)

Renier
Renier

Reputation: 1830

If you are using Birt reporting and you need a barcode I got it working by doing the following.

The barcode (Looks free) for Birt is located here : https://code.google.com/archive/p/birt-barcode-extension/downloads

I found it on eclips forum : https://www.eclipse.org/forums/index.php/t/796573/

In the zip file you get your Design Jar files as well as Runtime jars.

To get a bar code element in Birt copy the Design jar file to you birt installation folder in my case it was eclipse\plugins

Now in eclipse you will be able to see a new barcode control on you palette that you can use.

enter image description here

Create a new report variable.

enter image description here

Assign data to the variable in the OnRender of another Element that contains your data.

 vars["MyBarcodeData"] = this.getValue();

Now you can drag a bar code element from the palette to your report. And you select the barcode type, encoding and then the barcode text witch will be the report parameter that you created.

enter image description here

Double click on the parameter to get the code.

enter image description here

Click Ok and that should be it. Ps you might have to set the width and height of the bar code.

When you run the report the data that you assigned in your report parameter will be bound to the bar code and you bar code will be generated.

Hope this helps someone else.

Upvotes: 1

Related Questions