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.
Simple Process - can't make it work
-
- Posts: 7536
- Joined: Sun Apr 24, 2005 12:36 am
- Contact:
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.
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)
Version 8 (Build 2358)
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?
Back to your suggestion, are you saying that the IF statement you suggest could return a value without a FIND statement?
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
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