Is there any way to select fields from multiple domains?

0

I am trying to create a new ad hoc view, however I am limited in the fields which I can select based on the domain I choose. I have a field that I want to add but it is not in the current datasource/domain that I have. Is this possible?

christina.ting's picture
Joined: Jun 19 2017 - 8:56am
Last seen: 6 days 13 hours ago

3 Answers:

1

(I'm afraid I'm too lazy to watch videos, so I hope this is right.)

You can join tables in a database to put them in a domain in JRS.  So if you have five tables in your database, and there is a way to join them all up, you can put them all in the same domain and then use them in ad hoc.  (Databases don't normally have domains so I'm guessing you mean tables).

The fields don't have to have matching *names*, but they have to make sense to match on. For example, if I have LAST in one table, and SURNAME in another table, then I can still make a join, because that makes sense.  But if I have a table that has NAME and it means Last Name, and another table with NAME and it means First Name, then making that join doesn't make sense.  So you are looking for a field that between the two tables functions as some kind of key field, whether or not it has the same name.

If you have tables in your domain and you have set it up so they are not connected to each other in any way (for example, you have A joined to B, and C joined to D, but no other connections), you can't use the disconnected chunks (sometimes called islands) in the same ad hoc. (So you have to choose between A&B vs. C&D.)   But if there is a field that it makes sense to join on (so say, A has Last and D has Surname), you can go in the domain and modify and make the join and then you can get all of them into the same ad hoc view. 

 

elizam's picture
2040
Joined: Mar 5 2012 - 9:19am
Last seen: 17 hours 3 min ago
1

No, it is not possible.  You would need to create a new domain that contains all the fields you want.

You can create a virtual data source that combines multiple data sources, then create a domain on top of that.

elizam's picture
2040
Joined: Mar 5 2012 - 9:19am
Last seen: 17 hours 3 min ago
0

thanks @elizam. I'm am such a noob at this so please forgive my dumb questions.

I watched a video on how to create domains and what I did was basically select matching fields between 2 different domains and then did a left outer join to connect the two domains that contains all the fields that I want. So for example if domain A had a field called "ID" and domain B had a field called "ID" I selected both these fields and connected them. This is so that I could get access to a field in domain A that is not currently in domain B.

However, I noticed that some people did not connect domains based on matching fields b/w tables, they just connected any field from table A and any field from Table b? 

Which way is the correct way? Am I doing this correctly? I watched this tutorial: http://community.jaspersoft.com/wiki/jasperreports-server-domains-video

 

Thanks so much!

christina.ting's picture
Joined: Jun 19 2017 - 8:56am
Last seen: 6 days 13 hours ago
Feedback