Jump to content

Object State References from Data Tables


Recommended Posts

I would like to reference state values associated with objects within a data table.  For example, suppose I have a Data Table, call it Tab1, with an Object Reference column called Obj.  The first entry in the object reference column is a resource called Res; thus, Tab1[1].Obj points to Res.  How do I access the value of Res.CurrentCapacity using the table reference?  To make this a little more complex, what if the state were a vector of integers?  Thus, what I would like to reference would be something like Res.vector1[1].

Link to comment
Share on other sites

(state where the object is stored).(type of the object).(expression)

So, in your example you should type: Tab1[1].Obj.Resource.CurrentCapacity.

Same logic applies to object state variables. If you want to know the current capacity of a resource stored in a object state variable named ObjState, call it as ObjState.Resource.CurrentCapacity

 

I attached a file if you want to see it in action. I'm not sure if this works with vectors, I never tried it.

Object Referencing.spfx

Link to comment
Share on other sites

×
×
  • Create New...