What is the purpose of the <group> tag in jrxml files - jasper-reports

can anyone explain in very simple words what the <group> tag stands for. I already read this: enter link description here
But I can't get it, I played with reports over three hours but can't get any results.
__
I have a csv datasource looking like that:
Name | Value
-------------
Ab | 123
Ba | wow
Cb | got
De | it
For instance I would like to get only the entry in the value column where the entry in the Name column is "Cb" (would be "got").
Hence, I created a group with: following expression: $F{Name}.compareToIgnoreCase("Cb")
Unfortunately I always get the entire column although I only want one entry.
Do I use the group tag in the right way? Maybe I have misunderstood the intended purpose of this tag.
Any help would be appreciated.
2014-March-22:
I made a simple example PastBin:minimalcode-jrxml-file using following csv file as datasource:
Name;Tom
Birthday;01-May-1980
Country;Germany
sex;male
Here is a screenshot of the design view (ireports 5.5.0):
And here is what I get when I click on preview (in ireports), unfortunately this is not what i want:
Maybe anyone can help.
Thanks

The purpose of this tag is to "group/unite data based on a specific column value. Let's take for example the classic HR schema. Every Employee is linked with a specific Department. While getting all the employees inside a report, you can "divide" them in groups based on the department on which they are connected (i.e: by creating a group with for the employee.department_id attribute). A simple usage might be creating different tables with employees records for every department. Basically, is the same function as the Group clause in SQL (only that Jasper is aware of these groups and allows you to customize them).
In your case, i'm not quite sure that the expression used is creating a jasper-group. Anyway, what you're trying to do (i mean, getting only that record) can be easily accomplished by a "WHERE" clause inside the report query: WHERE name='Cb'

You don't need group use filter expression:
<filterExpression><![CDATA[$F{Name}.equalsIgnoreCase("Cb")]]></filterExpression>

Related

Return a value based on a function in placeholder in oracle Apex

Sorry if this is a "stupid" question, but I am new to Apex.
I made 2 processes on the create button: one is to insert into the department table and the other one to send an email with some info, among them the department too.
I made an email template and I want to display the department name, not the id which is inserted into the table. So I thought, that maybe I can do that with a function, like in the picture attached(get_department_by_id - returns the name of a department).
[example][1]
[1]: https://i.stack.imgur.com/bjBag.png
The help function in the builder usually gives enough info. Here is the help for "Placeholder values"
So only Application, Page Items and System Variables are allowed.
Note: There are multiple places in APEX where you can pass a number of arguments (links, branches, etc) but nowhere the use of functions is allowed.
This is how it worked for me.
I created a computation, with the computation of type "Expression" with source get_department_by_id(:P7_ID_DEPARTMENT) and Condition Type "Request = Expresion 1" with source the name of the button(ex.create).
Thank you Koen Lostrie for the guidance!

Prioritise which identifier to use

My crystal report pulls data about books, including an identifier (isbn, issn order number etc.), author, and publisher.
The ID field stores multiple ways to identify the book. The report displays any of the identifiers for that record. If one book has two identifiers; issn and order number, the report currently displays one apparently at random.
How can I make it prioritise which type to use based on a preset order? I figured some sort of filter on the field could work, but I haven't figured out how. I can't edit the table, but I can use SQL within the report.
If all the different types of ID are stored in a single field, your best bet is to use a SQL Command inside your report to separate them into multiple virtual fields.
Go to Database Fields / Database Expert, expand the connection you want to use, and pick Add Command. From here you can write a custom SQL statement to grab the information you're currently using, and at the same time separate the ID field into multiple different fields (as far as the report will be concerned, anyway. The table will stay unchanged.)
The trick is to figure out how to write your command to do the separation. We don't know what your data looks like, so you're on your own from here.
Based on the very little information that you have provided and if i was to make a guess.I suggest you make use of the formula field in your report and then use something like this to accomplish your goal.
IF ISNULL{first_priority_field_name} OR {first_priority_field_name} = '' THEN
{second_priority_field_name}
ELSE
{first_priority_field_name}
Use nested IF statement in case there are more than 2 identifier fields.

Filemaker Value List Troubles - Missing Items

I am relatively new to Filemaker programming, but I have come across what I thought was a bug, which I have been tearing my hair out trying to squash, only to find it is more a "feature" than a bug. I have a field set as the key for lookups in a ms sql database which I have created a relationship with. I have it set as a drop down, and it is showing 2 fields (last name and first name). Unfortunately, it only shows 1 person per last name in the sorted list (example, there are 5 people with the last name "Bennett" but only 1 shows). After driving myself nuts trying to find the error, I found the following in the filemaker troubleshooting section:
"
If the value list is defined to display information from two fields, items will not be duplicated for the field on which the value list is sorted. For example, if the value list displays information from the Company field and the Name field, and if the values are sorted by the Company field, only one person from each company will appear in the value list."
As I read it, I can't do what I need to do with a value list (display EVERY last name from the sql file) so what other options do I have? I have experimented with creating a portal which DOES show a list of ALL the last names and first names, but I don't know/understand enough to know what logic/functionality I need so if I click one of the people in the portal list it will do the same thing as if I clicked it in a dropdown value list, which is to then do the lookups and populate the rest of the fields in this database from the information in the record in the sql database. Any and all help would be greatly appreciated, and I appreciate any help any of you can offer. Thank you!
There might be some things that cause this;
You cannot create a link based on a calculation that needs to be calculated each time (Filemaker does not know what to do with this, logical in a way)
Based on what you do I would personally link the two tables based on an lets say company ID instead of a name, as a one to many join. This will definitely eliminate the 'feature' filemaker has of showing unique names only in the joined table. On database level I would join on ID, on Value list I would select the ID as first field and the (calculated) name as second field, than showing only the second field (option in the value list definition popup) for your selection list.
Hope this helps.

SSRS Multiple Dataset Errors

I have a simple SSRS report that displays data from one table. What I want to do is have a distinct list from that table displayed in a drop down list for the user to select. If I only use one dataset I can get it to display, but it displays values from the column multiple times.
Example
Bob
Bob
Bob
Cathy
Cathy
If I create a second dataset that will list distinct values I get the following error message:
An Error occurred during local report processing. The definition of the report is invalid. The Variable expression for the report 'body' refers directly to the field without specifying a dataset aggregate. When the report contains multiple datasets, field references outside of a data region must be contained within aggregate functions which specify a dataset scope.
I"m trying to follow the example I found here:
http://msdn.microsoft.com/en-us/library/aa337400.aspx
The second dataset is only for the parameter list. I don't understand why it's causing problems with the actual report.
It's impossible to tell exactly where without the report definition, but there is an item on the report that is referencing a field or Dataset, and was implicitly using the only Dataset present in the report, but now doesn't know which Dataset to use once more than one is added to the report.
For example, when you create a table you can set a Dataset associated with it. If this is not set and there is only one Dataset, it doesn't matter as it will take the only one available. Once you add a new Dataset, the table doesn't know which one to use and you'll get the error you're seeing.
Another way to get the error is specifying a field in an expression, e.g. in a TextBox in the report somewhere without specifying the scope; just set the scope to a particular Dataset e.g. if you have:
=Count(Fields!name.Value)
change this to:
=Count(Fields!name.Value, "DatasetToUse")
If you've only got one Dataset the first expression will run fine by using the only one available, but once you add another it won't know which to use and it will error.
in the query (SQL) you should add DISTINCT clause at the beginning, that way, you will get only one record per value. Check out http://www.w3schools.com/sql/sql_distinct.asp
Double click the Dataset which contains that field.
Go to fields on the left and delete that field.
Add new field by clicking Add -> Query Field.
Just type in the name of the new field under field name and field source.
It happens when you have added a field by selecting "Calculated Field" instead of "Query Field" from Dataset Fields list tab.
Cheers,
Ahmed Latif

Two SQL query inside single JasperReport and populating Data

We are using reports in our web application.
The report is generated using JasperReports.
The problem I am facing is:
My SQL query fetches data based on a where clause:
SELECT * FROM table WHERE level='c'
I can easily show this information inside the iReport.
But I need to fire another query where level='d' and the information for the same needs to be appended to the report with that of level='c'.
I tried grouping both the outputs. But problem is how do I fire two different query while generating the report because I can write only one query in QueryBuilder inside the iReport.
Is there anyway of achieving the same.
In essence:
The report should look like:
Level=C
Name Age Phone number
Level=D
Name Age Phone number
Level D should appear only after level c is completed.
Can anyone please guide.
I finally managed to achieve the same..Grouping the data using level_id..
Initially I was trying to group in a different manner and hence the value was not getting shown..
The same is explained pretty nicely in ireport Ultimate guide-3 document.