Sub-query question

Contains tips for configurators working with Aware IM
Post Reply
ckacoroski
Posts: 58
Joined: Mon Nov 13, 2006 9:15 pm
Location: Bothell, USA

Sub-query question

Post by ckacoroski »

I have a changelog object that has an attribute that is the uidnumber of the staff object. How do I write a query that will return all changelog objects that are associated with the staff object with the last name of "kacoroski". I want something like:

Find ChangeLog where ChangeLog.ObjectNumber = Staff.UidNumber AND Staff.LastName = 'kacoroski'

The above doesn't work so I am missing something fundamental here. Thanks for your help.

ski
ckacoroski
Posts: 58
Joined: Mon Nov 13, 2006 9:15 pm
Location: Bothell, USA

Post by ckacoroski »

Ok, I got it to work with this:

Find ChangeLog where Exists Staff where (Staff.LastName= 'kacoroski' and ChangeLog.ObjectNumber = Staff.UidNumber)

Could someone tell me why this works :)?

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

Post by aware_support2 »

The first version does not work because the condition "Staff.LastName = 'kacoroski'" does not relate to the object being searched. The subquery in the second version fixes this problem.

If you had a reference attribute to Staff in ChangeLog instead of the ID you would not need a subquery and could use a simple query like this:

FIND ChangeLog WHERE ChangeLog.Staff.LastName = 'kacoroski'
Aware IM Support Team
ckacoroski
Posts: 58
Joined: Mon Nov 13, 2006 9:15 pm
Location: Bothell, USA

Post by ckacoroski »

ok, not sure how to make the reference attribute happen. Currently I have a rule like:

If Staff.LastName WAS CHANGED AND NOT(Staff IS NEW ) Then
CREATE ChangeLog WITH ChangeLog.Type='Modify',ChangeLog.ObjectNumber=Staff.UidNumber,ChangeLog.Message='LastName '+OLD_VALUE(Staff.LastName)+' changed to '+Staff.LastName

How would I add to this rule to insert the new ChangeLog into a reference attribute?
aware_support2
Posts: 595
Joined: Sun Apr 24, 2005 2:22 am
Contact:

Post by aware_support2 »

You can add attribute Staff of type Staff to object ChangeLog and then add "ChangeLog.Staff=Staff " to the CREATE action.
Aware IM Support Team
Post Reply