Undefined Method for #
Hello Unmet!
I am trying to manipulate model object fields via a measure and have found the object that I need to modify, However whenever I attempt to use any of the method names for that object ie. "Set" I get an error saying "Undefined method [insert method name here] for #. I know I have the correct object variable because I am able to use the .name and print to the console.
It seems there must be a bridge to the Hash and the fields of the object.
Unmet! Love it!
I'd bet your object isn't a "Class" but "OptionalClass", eg it's zone a "ThermalZone" but an "OptionalThermalZone", which you have to
.get()
(after checking if.empty()
of course) before you can access its methods.Another possible cause in addition to what @Julien Marrec mentioned is if you are looping through schedules using
model.getSchedules.each do
and then try to use a method specific toscheduleRuleset
likeschedule.defaultDaySchedule
. You would have to doschedule.to_ScheduleRuleset.get.defaultDaySchedule
. Should of course check if it is initialized before using.get
.thank you guys for all of your help! I've tried different solutions to now avail. I am currently now using the model.getObjectByName("RefrigerationWalkInZoneBoundry"), checking .empty? and then using the .get and it's throwing the "Optional not Initialized" error. Is the name of my object off?
Use
model.getClassNames
to retrieve a list of objects of classClassName
, eg:first_walkin = model.getRefrigerationWalkInZoneBoundarys[0]
. Alternatively, usemodel.getRefrigerationWalkInZoneBoundaryByName("The Name of Your Walkin Object")