Change the order of questions in Templater?

Hello, I hope you understand my question…
I am trying to create a question form. The general order in which Templater asks questions when we run the template is from bottom to top (5,4,3,2,1) and my question is:
Is it possible to change the order in which these questions are asked?
Thanks and regards.

1 <% tp.system.prompt("where have you gone to eat?", "") %>
2 <% tp.system.prompt("what did you order to eat?", "") %>
3 <% tp.system.prompt("and drink?", "") %>
4 <% tp.system.prompt("how much did the food cost?", "") %>
5 <% tp.system.prompt("will you eat there again??", "") %>

PS: I know the easy answer is “change the order of the questions”, but in the template I’m creating, there are more questions that are mixed with:

<% await tp.system.suggester(["YES", "NO"],["YES", "NO"],false,  "Have you worked today??") %>

The idea is to include something inside the question codes, to change their order…

You could use <%* and %> to wrap a larger code block. Store the message and an ‘order property’ (e.g. 5 for the 5th message) as properties of an object. Store the list of these objects in an array. Then loop over these and pass the values to tp.system.prompt.

This would allow you more control over the sequence.


‘Javascript Execution Command’



1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.