How to use loops in JasperReports .jrxml file? - loops

I am using iReport Designer to design the .jrxml file.
How can I use the for loop or if loop in .jrxml file?
Is it possible?
If yes how?

You may wish to use a scriptlet. It's basically a Java class that extends either of the following two classes:
net.sf.jasperreports.engine.JRAbstractScriptlet
net.sf.jasperreports.engine.JRDefaultScriptlet
In a scriptlet, you can indicate that a certain piece of code should be executed every time a report event occurs, e.g., report, page, or column initialization.
In a scriptlet, you may use loops. You may access fields, parameters, and variable values. You may also adjust variable values.
There is a chapter on scriptlets in the JasperReports Ultimate Guide.

Well what you can do is create a list of selected fields(which client UI selects) and pass it as a collection to JasperFillManager.fillReport and in the jrxml create a field names _THIS which will represent the value's in the List.
And as you want those field to printed in loop, place them in the detail band of the report.

Related

Selecting values from a fixed set at random in JMeter

The problem I'm trying to solve is how to go about randomizing HTTP requests with multiple available values of parameters one would manually select via a drop-down list. I'm doing this in JMeter so AFAIK I cannot just declare an array containing values of parameters that said drop-down list options refer to and then use random indices for values.
For the sake of simplifying the problem - let's say I'm writing a test plan where a thread searches for a book title in an e-bookstore and goes to 'view' a found item. I want to start a buch of threads but don't want them all to search for the same book. I do know all titles available but do not know how to make each thread search for a different one.
I could try defining a varable per value and use __RandomFromMultipleVar() with all variables as its parameters but that would be quite a chunky piece of code if I wanted to select from more than just a few values.
If there's a way of defining multivalue variables, it would realy come in handy.
You can add User defined Variables under Http Request with name and value
Example:
Name= option_1;option_2; option_3 and different Values for each option.
User Defined Values Example
In Http request body add below code in place where you enter value.
"${__V(option_${__Random(1,3,)})}"

Azure Search: rotationFromOriginal not properly populated

As I am reading here, "when the imageAction is set to generateNormalizedImages, the new normalized_images field will contain an array of images. Each image is a complex type" which should contain a very important field for my scenario (rotationFromOriginal).
I noticed that, even if Azure Search perfectly accomplish the rotation of the images, this property will always be 0 (unlike other fields as originalWidth, which are correctly populated).
Do you know why I have this issue? Am I the only one?
AFAIK, the value of rotationFromOriginal was in normalized_images and it was as an input, so it must be populated at first.
And use the parameters in normalized_images json file to rotation and process image. For more details, you could refer to this article.

How to create a Drupal rule to check (on cron) a date field and if passed set field "status" to "ended"?

I'm trying to create a custom rule (using the Rules module) so that every time the cron runs, this rule checks a date field in a custom content type I created. If that date has passed then I want to set a list widget from active to ended.
This is how far I get when trying to create this rule:
Set React on event to Cron maintenance tasks are performed
Add Condition > Set Select the condition to add to Data comparison > Continue
Here is the issue: Data selectors only has site and no access to field data.
Any ideas where I'm going wrong here?
The problem with Rules condition "Cron maintenance tasks are performed" is that at that point, there is no access to the node object so any checks/manipulations on the node are not possible. As a solution, instead of Event = Cron maintenance tasks are performed, use Event = Node: Content is viewed. You can leave it open for any content type so that when someone visits the website and opens at least one page, some action will be triggered.
You need to create a rules component first:
Go to Rules > Components (admin/config/workflow/rules/components)
Then create a new component and select 'Rule' from select list
Set a name for this component and in the table below select:
Data type: Text Token
Label: A name that you want
Machine name: Use the same name of the label but set here only lower case and underscore
Usage: Parameter
In the component add the condition 'Data comparison' and select node:type
Add other conditions that you want
Set the actions that you want and save
Now go to Rules (admin/config/workflow/rules) and create the rule with action on cron maintenance (as you have already done)
Jump the conditions section and in the actions:
New action: Add a variable
Value: Text
Then write the value of this variable just like the machine name of content type that you want to cycle on (if you want you can change the name and machine name of this variable in the section below)
Now add another action 'Fetch entity by property'
Entity type value: Node
Property value: Type
Data selector: the variable created at the point 8
Now add a loop in parameter list use the variable provided by 'Fetch entity by property'
Add an action in the loop (click on the link to the right of loop row) and select the component created in the point 2 and pass the variable provided by loop
I state: I do not know if it works but at least it should direct you towards the right path
Sorry for my english, I hope you understand everything :)
Yes you should be able to get this to work using the Rules module to implement what you're looking for, but I recommend you to also combine that with the Views Rules module. Some details about this module (from its project page):
Provides Views directly as Rules actions and loops to seamlessly use view result data.
The previous quote may seem a bit cryptic (it may make you think like "so what, how can this help me?"). Therefor some more details about how to move forward using these modules:
Create a view (using Views) so that you have 1 Views result (row) with all the nodes you want to be processed (related to your custom content type and if possible filter somehow using your date field). Whereas that view has fields (columns) for whatever is needed in subsequent steps, e.g the node ID, the date field, and possibly other fields as well. You'll need these View fields later on as values to be processed by your rule, "to set a list widget from active to ended*" (as in your question). Important: use a Views display type of "Rules".
Remove that "add condition" (in the custom rule you started) and, instead, use the Views Rules module to iterate over each of these Views results in a Rules action, using the Rules technique known as a "Rules Loop".
For each iteration step in your Rules loop, perform a Rules Action to "do your thing" (= to set a list widget from active to ended). At that point you'll have all data from each column of your Views results available as so called Rules Parameters. So at that point it's a piece of cake to adapt the value of that list widget for the node you're processing in that loop.
Optionally, you may also want to add whatever extra Rules Condition(s), also up to your own imagination. Typically the things you cannot, or have not yet, expressed as a Views filter. However, if you have a choice between using a Views filter and an extra Rules Condition, I recommend to go for the Views filter, because that will reduce the number of your iterations in your Rules loop (performance!).
Easy, no?

How to not have repeating elements in this Access-SQL server-Visual Basic 6 (ADO) Form (Master Detail)

As stated above I am using the internal Access visual basic 6 editor along with Microsft SQL server, what I want to function is not having repeated elements in the sub form which is in a table called Order details which has a relation to the main form called Orders.
What im getting is repeated information in the sub form, but all I want is the information to show according to the Order code or Id (Codigo Pedido)... and as you can see here that isn´t happening:
Form:
http://www.flickr.com/photos/63259070#N06/6871552418/
Code:
https://docs.google.com/document/d/1bn71VqxzB1W55sHcKMstCSxnIbmP5cyYWkBVnF1tzVs/edit
I don´t know what to do, should I use parameters, should I use SQL queries, should do some sort of looping structure... Im lost.., So if anyone could help me, even in the most minimal way I would seriously appreciate it
Do not use the text property in MS Access, then you will not have to set focus:
''Me.ctCodigo.SetFocus
Me.ctCodigo = rs.Fields(0).Value
If you must qualify, use .Value, which is available whether or not the control has focus.
I am not sure why you are not using linked tables, you do not mention an ADP, but if you must use ADO, consider binding the recordsets, it will make life easier: http://support.microsoft.com/kb/281998

How can I map elements of one enum to another?

I'm using C. I have to large enums, one of menu ID's and one of window ID's. At the moment they're mapped to each other by an array, so the elements have to be put into the array perfectly and as soon as something changes work has to be done to put them all back into the right place. What would be a better way of mapping the menus to the windows? Thanks
Are you explicitly assigning values to the members of each enum? How do menu IDs map to window IDs? Can you post part of the enums as an example?
If the enums are lengthy, this might be a good candidate for a code-generating script. Store your IDs in (for example) a CSV file that lists matching pairs of Window IDs and Menu IDs. Then, write a script that parses the CSV file and generates a header containing the appropriate enum definitions. If you are building your project using makefiles (or similar), it should be fairly straightforward to integrate this type of auto-generated header into your build system.

Resources