I am importing the text separated using split by new line
I need 2 parts for the snippet, top part will only list text to the left of the - sign
The bottom part will outputthe string to the left of the - sign and then the whole text in detailed explanation. But the order when using for i starts at 2 not at 1 and pairs the heading with the text for the next heading.
Something wrong in my for i loop but I cannot figure it out,
First part is the snippet I use, second the imported snippet
{headings=sort(map(split({import:!test01}, "\n"), item -> split(item, " - ")[1]), (a, b) -> comparestrings(a, b))}{content=split({import: !test01}, "\n")}{explanation1=[split(content[i], " - ") for i in seq(1, count(content))]}
{listoflists=[headings[i]:explanation1 for i in seq(1, count(content))]}{formmenu: values={=headings}; name=chosenheading; multiple=yes}
{note}{explanations=[split(content[i], " - ")[1] for i in seq(1, count(content))]}
{listoflists=[headings[i]:explanations[i] for i in seq(1, count(content))]}
{formmenu: values={=headings}; name=chosenheading; multiple=yes}
{=join([concat(choice, ": ", listoflists[choice]) for choice in chosenheading], "\n")}{endnote}
option1 - for option 1 long explanation blah, blahm blah
option 2 a bit longer title - for option 2 Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec malesuada eu eros ut porta. Sed id viverra odio, ac vulputate ligula. Phasellus convallis augue eu turpis lobortis pulvinar. Nunc in egestas lacus, ut mollis augue. Morbi malesuada feugiat rhoncus. Nam cursus lacus in ipsum hendrerit vehicula.
option 3 - for option 3 Integer faucibus efficitur urna, commodo scelerisque arcu aliquet sed. Quisque porta, libero eu iaculis tristique, mi purus hendrerit massa, dictum sodales risus lacus non est. Ut pulvinar, libero at ultrices rhoncus, felis sem facilisis tellus, suscipit scelerisque diam dui et odio.