Populating Attributes based on two other pm Attributes

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
PointsWell
Posts: 1457
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Populating Attributes based on two other pm Attributes

Post by PointsWell »

I am having a logic problem and it is my misunderstanding that would appear to be causing it.

I have a BO (Contract) with 3 PM attributes:

1 - Territory - which is a pm relationship to a Table Territories. An attribute of Territories is another pm relationship Countries.
2 - Excluded - is a pm relationship also to Countries
3 - Countries - which is a pm relationship to, you. guessed Countries.

What I am trying to achieve is a population of the Countries attribute based on all the Countries in Territory.pm_Countries that are not contained within Excluded and for this to refresh each time either Territories is updated or Excluded is updated.

The Business Rule that I had built is:
If Contract.pm_Territories WAS CHANGED OR Contract.pm_Except WAS CHANGED Then
Contract.pm_Countries=(Contract.pm_Territories.pm_Country WHERE ( NOT(Contract.pm_Territories IN Contract.pm_Except)))

But I am getting an error:
Syntax error at token "." (column 10).

Column 10 is the period between Contract.pm_Countries on the second line, my experience to date has been that when I get these sorts of errors I have approached the problem from the wrong direction and should be using a different approach. Could someone point me in the correct direction please.

Thanks in advance
tford
Posts: 4238
Joined: Sat Mar 10, 2007 6:44 pm

Re: Populating Attributes based on two other pm Attributes

Post by tford »

Not your exact scenario, but perhaps concepts here will be useful to you:

http://www.awareim.com/forum/viewtopic.php?f=4&t=5274
Tom - V8.8 build 3137 - MySql / PostGres
PointsWell
Posts: 1457
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: Populating Attributes based on two other pm Attributes

Post by PointsWell »

Thanks. As I said coming at it from the wrong direction.

But now I have another question...

Now that I have realised I need to first find the Territories referred to in the field then find the Countries that are contained within that Territory's list of Countries. But I am getting an error Value for path LuTerritories.pm_Countries could not be resolved. So I am thinking I have misunderstood the structure here

If LuTerritories.pm_Countries is a multi value peer does this resolve itself as a list?

My logic was
FIND Territories
FIND Countries where they are IN Territories.pm_Countries

but this is obviously flawed.

Code: Select all

If Contract.pm_TerritoriesExclusive WAS CHANGED OR Contract.pm_Except WAS CHANGED Then 
FIND LuTerritories WHERE (LuTerritories IN Contract.pm_TerritoriesExclusive)
 FIND LuContCtry WHERE (LuContCtry IN LuTerritories.pm_Countries) AND NOT(LuContCtry IN Contract.pm_Except) 
Contract.pm_CountriesExclusive=LuContCtry
Post Reply