Score:0

How to get a delta value from a composite with ilimited values?

vn flag

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.

Score:0
vn flag

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

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.