Data Binding w/Custom Component Properties

Ok, I’ve got an odd one. I have a form (parent) that Im loading as a component in my dashboard when a customer is selected. Within that form is a subform (child) that is set to “Use as Component” with a couple of custom properties.

The data bindings set in the (parent) for the (child) are as such:
item -
self.item['address']
customer_id -
self.item['customer_id']

The data bindings set in the (child) are as such:
address_type.text -
self.item['address_type']
others are set for the values of the address but not relevent to this discussion

within the address simple object I have a key value pair for ‘address_type’, durring the (child) form initialization I need to access this value but when it loads it returns None.

Here is code for the (child) form:

class ChildForm(ChildFormTemplate):
  def __init__(self, **properties):
    # Set Form properties and Data Bindings.
    self.init_components(**properties)

    # Any code you write here will run when the form opens.
#     self.label_property_1_data.text = self._prop_1
#     self.label_property_2_data.text = self._prop_2
    print(f'Property 1: {self.label_property_1_data.text}')
    print(f'Property 2: {self.label_property_2_data.text}')
    print(f'Address Type: {self.label_address_type_data.text}')
    
  @property
  def sample_prop_1(self):
#     print(f'Getting Prop 1: {self.sample_prop_1}')
    return self.label_property_1_data.text
  
  @sample_prop_1.setter
  def sample_prop_1(self,value):
#     print(f'Setting Prop 1: {self.sample_prop_1}')
    self.label_property_1_data.text = value
    
  @property
  def sample_prop_2(self):
#     print(f'Getting Prop 2: {self.sample_prop_2}')
    return self.label_property_2_data.text
  
  @sample_prop_2.setter
  def sample_prop_2(self,value):
#     print(f'Setting Prop 2: {self.sample_prop_2}')
    self.label_property_2_data.text = value

Data Binding w/Custom Properties

When I run that clone, I see the values in the child form. The print statements print out None, but the fields themselves show the actual values.

If I move your print statement to a form_show event on the child form, they show the right values. I think you’re just running into a timing issue on when you’re trying to access your label text.

Perfect! That does the trick.

Thank you!!!