0

I have this webform with composite field where I add a file and a field where I add a number. print

What I wish is using the token, to rename the file with number inputed in the number field. But the thing is I have a composite with multiple ilimited values and I can only do it if I declare a delta number as the following token: [webform_submission:values:element_key:delta:sub_element_key]

How can I do it programatically if it is possible?

Also, it's possible sum up composite multiple values using computed twig? As above, the delta seems the problem.

1 Answer 1

0

For the first part of the question I still have no clue, it might not be (only) the delta the problem as I could work around it using computed twig data, but the fact the attachment and the number field are inside the composite, what may create a looping error.

As for the second question, here what worked for me using the computed twig from webform:

SUM TOTAL OF THE COMPOSITE SUBELEMENT:

{% for item in data.composite_element_key %}
  {% set sum = item.subelement_key + sum ?? 0 %}
  {% if loop.last %}{{ sum }}{% endif %}
{% endfor %}

Thanks to https://craftcms.stackexchange.com/a/16445

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.