I am trying to set up a class Method that does something if the predecessor's attribute = true. However, before I check that condition, I need to make sure that the predecessor actually has that attribute... if it doesn't exist, then it's an object from a different class and I don't care about it.
Is there a way to do this? I tried "existsObject," but it doest appear to be working. I'm assuming that it is just checking if the Object exists, no the Object's attribute.
if ?.pred(1).WorkStation = false
?.pred(1).EntranceLocked := false
Thanks in advance!
Solved! Go to Solution.
if it is a user defined attribute, you can use attrNo, it returns a number greater than zero, if the attribute exists and zero, if the attribute doesn't exist or if this attribute is a build in attribute:
if ?.pred(1).getAttrNo("WorkStation") > 0 if ?.pred(1).WorkStation = false ?.pred(1).EntranceLocked := false end end
or you check the name of the attribute
?.pred(1).isNameUnique("WorkStation") =false --> attribute exists
freelance simulation specialist