Queries in Aware

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
Jolee
Posts: 24
Joined: Wed Nov 09, 2005 3:55 am

Queries in Aware

Post by Jolee »

Hi, I have created Business Objects that are linked to each other and would like to know how to get the information from the bottom Object in the chain to show up at the same time as information from the top Object in the chain.

So ..
Object A
- attribute objectbs
Object B
- attribute objectcs
.. and so forth.

How do i query on Object A and an attribute in Object E also .. ?
Please let me know if this makes no sense.

Any and all help is appreciated.
Ta.
aware_support
Posts: 7523
Joined: Sun Apr 24, 2005 12:36 am
Contact:

Post by aware_support »

Hi Jolee,

not sure if I understood the question correctly, but let me try to answer anyway.

If you have a chain of linked objects from A to E you can use dot notation to query on any of the objects in a chain. For example, let's say has as attribute BRef that points to B, B has attribute CRef that points to C and so on. The query can look something like this:

FIND A WHERE A.BRef.CRef.DRef.ERef.SomeAttributeInE = 'Some value'

You can configure such queries in a query editor or use such expressions as actions in rules.

Please let me know if this answers your question.
Aware IM Support Team
aware_support
Posts: 7523
Joined: Sun Apr 24, 2005 12:36 am
Contact:

Post by aware_support »

"For example, let's say has as attribute BRef that points to B" should read
"For example, let's say object A has an attribute BRef that points to B'
Aware IM Support Team
Jolee
Posts: 24
Joined: Wed Nov 09, 2005 3:55 am

Error

Post by Jolee »

Does this only work for one to one relationships? As I am getting the error:

'Error analysis path Client.......Finish_Date Reference lists in the middle of the identifier are not allowed'

What I wanted to find, was the name of the Client, and the Finish_Date from table E in one nice row returned.
Not just the Client (table A) information if it had a Finish_Date.

Make more sense?

Cheers
Jolee
aware_support
Posts: 7523
Joined: Sun Apr 24, 2005 12:36 am
Contact:

Post by aware_support »

Hi Jolee,

can you tell me exactly what objects and attributes you have in your example, how they are related and what you are trying to find?

In general, the example I described indeed works for one-to-one relationships. If you want to use many-to-many relationships you have to use "IN" expression, for example:

FIND A WHERE A IN B.ARefs AND A.TextValue='ABC'
Aware IM Support Team
Jolee
Posts: 24
Joined: Wed Nov 09, 2005 3:55 am

Post by Jolee »

Okay my Business Objects are as follows:

Client
att: System --Type: R_System

R_System
att: Properties --Type: Property

Property
att: IPUs --Type: IPU

IPU
att: Lic --Type: IPU_L

IPU_L
att: Finish_Date --Type: Date

I want a query to run that lists all Clients that the Finish_Date of IPU_L is defined. (or if easier, greater than IPU_L.Start_Date)
Where each business object can have one or many of another related to it.

Any help would be fantastic!!
Thanks.
aware_support
Posts: 7523
Joined: Sun Apr 24, 2005 12:36 am
Contact:

Post by aware_support »

Hi Jolee,

your query should look like this:

FIND Client WHERE EXISTS Property WHERE (Property IN Client.System.Properties AND EXISTS IPU WHERE (IPU IN Property.IPUs AND IPU.Lic.Finish_Date IS DEFINED))

Hope this helps.
Aware IM Support Team
Jolee
Posts: 24
Joined: Wed Nov 09, 2005 3:55 am

Post by Jolee »

That's great for showing Clients with Finish Dates.
But how do I also show the Finish Date for each client?

Ta.
aware_support
Posts: 7523
Joined: Sun Apr 24, 2005 12:36 am
Contact:

Post by aware_support »

According to the structure of your relationships there may be multiple IPU's per Client and so there may be multiple dates per Client. Which one do you want to show? Or do you want to show all dates per each client?
Aware IM Support Team
Jolee
Posts: 24
Joined: Wed Nov 09, 2005 3:55 am

Post by Jolee »

It's just occured to me I have given you slightly the wrong Business Objects.

It should be:
Client
att: System --Type: R_System
att: Trial --Type: y/n

R_System
att: R_Servers --Type: R_Server

R_Server
att: Lic --Type: R_Lic

R_Lic
att: Finish_Date --Type: Date
att: Created --Type: Date

Where the Business Objects are still multiple relationships between each.

Having said this, I would like to see:
The information for the last created R_Lic if the Trial = 'Y'

eg. in table format(?)
Client Name, Trial(Y), R_Server, Finish_Date

Sorry for giving you the wrong information.
Jolee
aware_support
Posts: 7523
Joined: Sun Apr 24, 2005 12:36 am
Contact:

Post by aware_support »

Hi Jolee,

it is important for me to understand where there are multiple relationships:

Here is my understanding. Tell me if I'm wrong

1) Client - System
a Client is related to one System, a System may have multiple clients
2) System - Server
a System is related to multiple Servers, a Server is related to only one System
3) Server - Lic
Server is related to one Lic, Lic is related to one Server.

Is this right?
Aware IM Support Team
Jolee
Posts: 24
Joined: Wed Nov 09, 2005 3:55 am

Post by Jolee »

1) Client - System
a Client is related to one System, a System may have multiple clients
-- A Client may have multiple Systems, and System has one client.

2) System - Server
a System is related to multiple Servers, a Server is related to only one System
-- Correct

3) Server - Lic
Server is related to one Lic, Lic is related to one Server.
-- Server may have many Lic, but i'm only interested in the last Created one, and a Lic is related to one server.

Jolee
aware_support2
Posts: 595
Joined: Sun Apr 24, 2005 2:22 am
Contact:

Post by aware_support2 »

Jolee,

You can take advantage of Aware IM feature known as 'matching attribute' to establish visibility from Lic all the way back to Client. For example, you can add attribute Client of type Client to object R_System that will be a matching attribute of attribute System on object Client. The matching attributes describe the same link, so when you add a System on the form for Client, the attribute Client on R_System will be automatically initialised to point to the Client. Of course, you can now place attribute Client on the form for R_System so you can navigate from R_System to its related Client. Similarly, you can add matching attributes for other objects so the model looks like this:

Client
att: System --Type: R_System
att: Trial --Type: y/n
att: Name --Type: Plain Text

R_System
att: R_Servers --Type: R_Server
att: Client --Type: Client (matching to Client.System)

R_Server
att: Lic --Type: R_Lic
att: System --Type: R_System (matching to R_System.R_Servers)

R_Lic
att: Finish_Date --Type: Date
att: Created --Type: Date
att: Server --Type: R_Server (matching to R_Server.Lic)

To add attribute Client to R_System, open object R_System for editing in the Configuration Tool, click Add in the attribute section, and select Client as the attribute type. Click 'Existing' in the Matching Attributes In Client, select System as the matching attribute name, make sure Multiple Allowed box is not ticked (this is important).

Repeat the steps to add necessary matching attributes to the other two objects. Now you can use an expression R_Lic.Server.System.Client anywhere in the system to access Client from R_Lic.

The next step is to add an attribute ClientName of type Shortcut to object R_Lic. When prompted for Attribute Path, enter Server.System.Client.Name. Now you can configure a simple query on object R_Lic, sorted in descending order of R_Lic.Finish_Date that will display attributes Finish_Date and ClientName. This way you will see all instances of Lic with finish dates and client names with the most recent displayed on top of the list.

If, on the other hand, you want to see only the latest license for a server, you can do the following. Add attribute LatestLicense of type Date to R_Server. Add a rule to R_Server that will automatically register the date of the latest license with the server. The rule will look like this:

If R_Lic WAS ADDED TO R_Server.Lic
Then R_Server.LatestLicense = AddedR_Lic.Finish_Date

Next, add an attribute ClientName of type Shortcut to object R_Server with path System.Client.Name. Now you can configure a query on object R_Server that will display attributes LatestLicense and ClientName.

Let us know if you need more details.
Aware IM Support Team
Jolee
Posts: 24
Joined: Wed Nov 09, 2005 3:55 am

Post by Jolee »

Thank You VERY much for all your help!
It has explained alot and made new queries seem easier.
Works like a charm :o)

Is there specific documentation for explaining how to use queries?
aware_support2
Posts: 595
Joined: Sun Apr 24, 2005 2:22 am
Contact:

Post by aware_support2 »

Aware IM Help in the Configuration Tool and the User Guide document (located in 'docs' directory under the AwareIM installation directory) have plenty of information on configuring and running queries.
Aware IM Support Team
Post Reply