Newbie Help - Changing Relationships

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
GertV
Posts: 112
Joined: Thu Sep 10, 2009 9:39 am
Location: Bangkok, Thailand
Contact:

Newbie Help - Changing Relationships

Post by GertV »

Hi,

I'm quite new to AwareIM so please bare with me if I oversee an obvious solution.

I'm having an object members and an object member category. One member category can have many members but a member can only belong to one category.

Currently all my relations work correctly.

I have a rule defined that says the age of a member is above 60, the member category should change to 'Senior Member'

I have defined the action as members.category.name = 'Senior Member'

When the rule executes I get an error stating that the category 'Senior Member' already exists.

How do I change the member category for this member from 'Normal Member' to 'Senior Member'

Thanks for any help.

Gert.[/i]
aware_support
Posts: 7532
Joined: Sun Apr 24, 2005 12:36 am
Contact:

Post by aware_support »

Why are you getting an error that the category already exists? Do you have a rule that checks for the uniqueness of the category?

Please also check the Log Viewer, which displays in detail how Aware IM executes rules - this will help you identify the problem
Aware IM Support Team
GertV
Posts: 112
Joined: Thu Sep 10, 2009 9:39 am
Location: Bangkok, Thailand
Contact:

Post by GertV »

Yes indeed, I have a rule that checks the uniqueness of the category. I've studied the log and still cannot figure out what I am doing wrong.

As I understand it, my rule sets a new value to the member object. It just needs to link to another categorie. I am not updating the category object, so why does it execute the category uniqueness rule?

Am I doing something wrong or should I change the relationship in a different way?

Regards,

Gert.
tford
Posts: 4238
Joined: Sat Mar 10, 2007 6:44 pm

Post by tford »

Not sure why it didn't work, but try a rule something like this:

If Members.Age>60
FIND Category WHERE Category.Name='Senior Member'
Members.Category=Category
Tom - V8.8 build 3137 - MySql / PostGres
GertV
Posts: 112
Joined: Thu Sep 10, 2009 9:39 am
Location: Bangkok, Thailand
Contact:

Post by GertV »

Hi tford,

That was a great tip! It worked, thanks very much.

I still don't understand however why the solution I tried didn't work.

Gert. :D
BobK
Posts: 546
Joined: Thu Jan 31, 2008 2:14 pm
Location: Cincinnati, Ohio, USA

The reason why your origianl rule did not work

Post by BobK »

According to your first post above, your original action was:

Code: Select all

members.category.name = 'Senior Member'
This code will update the name attribute in the current category object that is referenced in the members object. Since a category object already exists with the name attribute set to 'Senior Member', you got the "category 'Senior Member' already exists" error.
Bob
GertV
Posts: 112
Joined: Thu Sep 10, 2009 9:39 am
Location: Bangkok, Thailand
Contact:

Post by GertV »

Thanks for the explanation Bob. I understand what I did wrong now.
Gert (running V8.0 build 2378 on Windows Server 2008)
Post Reply