I’ve created a little chat example. I think its quite nice on its own, but I have a question regarding the random functionality.
The bot should be able to generate random answers based on a set of values.
So how do you get a random string from a list in Axure?
Currently I use multiple cases with if statements - but obviously this doesn’t scale well.
Maybe adding another repeater would be a solution, but this creates just a lot of junk in the file.
What is your solution to this problem?
Hmm, another way to do it would be to store your bot responses in a repeater column, with the response numbers (e.g. 1, 2, 3) in another column. You could then have your button generate a random number, store it in a variable, and then refresh the repeater that contains your bot messages. OnItemLoad of that repeater, you can use a condition to check whether the randomly generated variable value matches the row number of one of your repeater rows, and if true, then that repeater adds the message from that matching row to the repeater that contains your chat message.
Here’s an example of the expression that would generate a random number between 1 and 3, for a repeater that has 3 bot responses (3 rows):