0

I am creating a webform that collects data on the number of private offices that a company wants in their workspace and then does calculations based on those quantities. I can easily do the basic calculations for those calculations. For example:

    ceo_office_qty:
      '#type': number
      '#title': 'Quantity Needed'
      '#admin_title': 'CEO Office Qty'
      '#min': 0
    ceo_office_total:
      '#type': computed_twig
      '#title': 'Total SF'
      '#admin_title': 'CEO Office Total'
      '#template': '{{(data.ceo_office_qty * 300)}}'
      '#store': true
      '#ajax': true

Then, I want to combine a number of these computed twigs together to get a total. I obviously can just to the math all over again in a new computed twig, but it would be simpler and more elegant (also less error prone) to be able to reference the data from the computed fields. For example:

  net_usable_sf:
    '#type': computed_twig
    '#title': 'Net Usable SF'
    '#admin_title': 'Net Usable SF'
    '#template': '{{(data.ceo_office_total + data.manager_office_total + data.std_office_total + data.small_office_total)}}'
    '#store': true
    '#ajax': true

Any idea on why the above doesn't work? This just gives me the quantity of fields added together, rather than their data, which is what I want.

Any help is greatly appreciated. Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.