Jump to content

Dynamic variables


rizmerc

Recommended Posts

Hi,

I have a requirement that needs me to create variables at run time which will store counts. I cannot create these variables at compile time as I do not know what they will be and how many there will be.

 

Here is the exact scenario.

 

Our model has 3 types of services, "Receiving", "Shipping" and "Accessorial"

The user can define as many subtypes under these types...so the services might be something like this..

 

Receiving - Boxes

Receiving - Pallets

Shipping - Boxes

Shipping - Envelopes

Accessorial - Shrink Wrap

 

We receive in our jasper reports a list of services rendered. I would like to keep count of the number of each sub type rendered.

 

So for example, the reports summary would say

 

SERVICE RENDERED TOTAL UNITS

--------------------------------------

Receiving - Boxes 6

Receiving - Pallets 7

Shipping - Boxes 4

Shipping - Envelopes 2

Accessorial - Shrink Wrap 10

 

Can this be done in jasper reports?? Please help!

 

thanks,

-Riz

Link to comment
Share on other sites

  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

not sure if subreports can help me.

 

i need a summary of subtypes which are user defined. how would i create a counting variable for the subtype "Boxes" of type "Receiving" when I do not know at compile time what the subtype name is?

Link to comment
Share on other sites

Hi,

 

I think the scriptlet functionality would give you the flexibility you need.

You could pass to the report the list of subtypes as a parameter of type Collection.

Then, in the scriptlet implementation, you would have the freedom to build the complex data structure you hold those counts and in the mean time you would have the instruments to perform conditinal incrementing of those counts using your own code.

 

In the end, you'll probably use a small subreport to displat those counts, because you don't know at design time how many counts there'll be.

 

I hope this helps.

Teodor

Link to comment
Share on other sites

  • 4 weeks later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...