can anyone suggest a usecase for insertquestions() and extractanswers()
Discussion posts and replies are publicly visible
to me, the real world use cases are pretty limited for these functions. The result of "Insertquestion" is a Text Array. So nothing else than a plain {"a","b","c"}.extractanswers() is just useful if you have a text or array of text which have question and answer in the same string value."What is your name? Ben!" is just one string value.->so this is very unlikly to happen.Reasons are mainly best practices: usually you define the question and the user will answer and you store just the answer in a specific variable/field
or
you are saving question and answer as own string values because they are inserted in two different textfields/paragraphfields.{"What is your name?", "Ben!" }
Yeah I think the original idea was that you could set up structured lists of strings that could easily be parsed out. The functions keyval() and insertkeyval() are similar. If you ever have a use case like this where you need to define key value pairs or questions and answers, I'd generally recommend storing the results in a list of map and then use a!toJson() to convert to JSON instead. Then you can always extract the results by going back from JSON using a!fromJson(), and it's a lot more common elsewhere to use structured JSON.
yes. totally with you there. a!map() or a cdt structure is way more suitable to archive a well structured solution. both functions are existing but both are relicts of older versions for me. But I would not use the JSON method the moment your data stays in appian itself and is just called within the appian context. Just a plain nested cdt or a second cdt with foreign keys to match questions to answers should do the trick.