Simple Process - can't make it work

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
kklosson
Posts: 1646
Joined: Sun Nov 23, 2008 3:19 pm
Location: Virginia

Simple Process - can't make it work

Post by kklosson »

I have a BO that is owned by another BO with a 1:1 relation.

From the owned BO, I use the following process statements to create a new owner object:

FIND OwnerObject WHERE OwnerObject.OwnedObject=ThisOwnedObject

If OwnerObject.ID IS UNDEFINED Then
ENTER NEW OwnerObject USING Main

If I remove the IF statement, a form appears to create the owner object, but with the IF statement, no good, the process just flashes and quits. I need the IF statement because if it's false then I will want to edit the existing object.
aware_support
Posts: 7536
Joined: Sun Apr 24, 2005 12:36 am
Contact:

Post by aware_support »

Adding rules that invoke UI (such as ENTER NEW) to the rules of an object is a BAD idea and is not guaranteed to work. Such rules must be in processes only. You need to restructure your rules accordingly.
Aware IM Support Team
kklosson
Posts: 1646
Joined: Sun Nov 23, 2008 3:19 pm
Location: Virginia

Post by kklosson »

Roger that. This is a process, not a rule.
Bryan
Posts: 195
Joined: Fri Apr 03, 2009 12:46 am
Location: Cincy

Post by Bryan »

It seems the issue with the process is with the context of the if statement. In the scenario you described when the if statement is triggered there would be no object in context to run the if statement against. Meaning you are specifically looking for the object not to be there.

What about creating a shortcut attribute in the owned object to the id or another required fielded in the owner object. This would allow you to check if that field is empty and then proceed with creation of an owner object if needed.

If OwnedObject.OwnerObjectSC.ID IS UNDEFINED Then ENTER NEW OwnerObject USING Main

This would also saving you from having to run the find that returns nothing.

Just a thought.
-Bryan
Version 8 (Build 2358)
kklosson
Posts: 1646
Joined: Sun Nov 23, 2008 3:19 pm
Location: Virginia

Post by kklosson »

Thanks. As you see in my original post, I start with a FIND statement which puts the Owned object in context (if it exists). Then the IF statement evaluates whether the object.ID IS DEFINED.

Back to your suggestion, are you saying that the IF statement you suggest could return a value without a FIND statement?
technopak
Posts: 287
Joined: Thu Dec 04, 2008 2:16 pm

Post by technopak »

Hi,

I don't understand how an object.id could be undefined - I thought the IDs were auto-generated by Aware. However, if I understand what you're trying to do, then something like this might work -

IF NOT EXISTS OwnerObject WHERE (OwnerObject.OwnedObject=ThisOwnedObject) THEN
ENTER NEW OwnerObject USING Main
ELSE FIND OwnerObject WHERE (OwnerObject.OwnedObject=ThisOwnedObject)
EDIT OwnerObject

It might seem long-winded, but it checks for the existence of the relevant OwnerObject and takes the correct action based on the check - which I think is what you are trying to do.

Sorry if I've misunderstood.

Peter
kklosson
Posts: 1646
Joined: Sun Nov 23, 2008 3:19 pm
Location: Virginia

Post by kklosson »

Actually, I think that may be the ticket. I'll give it a try soon.

Thanks!
kklosson
Posts: 1646
Joined: Sun Nov 23, 2008 3:19 pm
Location: Virginia

Post by kklosson »

Yep. That was the way to go. Thanks!
Post Reply