26-08-2013 04:15 PM
Hi,
I am creating new instance of application object with custom fields.
I would like to define some rules on some fields in order to raise errors if one is not filled based on specific values from another one.
Do somebody could help me to set such kind of rules?
Thanks
Solved! Go to Solution.
26-08-2013 05:18 PM
Hello Benoit,
with a more precise question I could give you a more precise answer 😉 but :
you can explore your metaAttribute (what you call "Field") and create a Macro via the "metaAttributeUpdateTool" metaAssociation. This macro will be launched each time someone tries to modify the value of your metaAttribute.
Your macro must contain 2 functions.
The first one is :
Function AttCtl_GetDefaultKind() As String 'To be short, use "Edit" for string metaAttributes 'And "ComboBox" for enumeration metaAttributes AttCtl_GetDefaultKind = "Edit" End Function
And the second one (with the most common things you will need...)
Function AttCtl_Update(Context, Status, ErrorMessage) Dim myObject, myValue Set myObject = Context.MegaObject 'To get the object where the fiel has been modified myValue = Context.EditText 'What has been type by the user (modification of the field) If <your test here> Then 'For example, if myValue <> myObject.getProp(<myOtherField>) 'If errorMessage is not empty, the update of the field will not be allowed ErrorMessage = "You have no right to use this value because..." End If End Function
Regards,
Lionel