Page 1 of 1
Single Choice dialog error???
Posted: 28 Feb 2014 00:43
by angelatwork
Hi, I really like the action single choice, but I think it's funny that you can click Ok without choosing /clicking a choice first.it does not feel logical. I would expect that action when choosing Cancel (and it does that too, that is :it does nothing ). Also if you put a default value one would think that it would be prechoosen for you (lit), but it is not.
I have tried to capture the OK, to stop this from happening (too quick on the OK button, without choosing something first) with expressions like if value ==null and or Ok= xx but nothing happens. Am I not thinking straight or is this a bug?
Re: Single Choice dialog error???
Posted: 28 Feb 2014 10:28
by Martin
Hi,
You can detect whether or not a selection was made by checking the variable
index after the dialog was shown. The default value should be selected when the dialog is shown when this value is available in the list. It's important that the default value matches exactly one from the list (it's case sensitive).
I recommend to make some experiments with a very simple flow first:
-trigger empty
-action
Input Dialog: Single Choice: 1,2,3,4,5,6 and default 3
-condition
Debug Dialog
Execute this flow manually and check the variables in the debug dialog (especially
operation,
value and
index).
value contains the value defined in the default value when no selection was made.
You could detect a case where no value is selected in a condition
Expression like this:
Regards,
Martin
Re: Single Choice dialog error???
Posted: 28 Feb 2014 13:25
by angelatwork
Thanks Martin, will try it out

Re: Single Choice dialog error???
Posted: 03 Mar 2014 23:17
by angelatwork
Well it worked. I don't use a default in one part of the flow and I want the cancel button to lead to one action and the Ok button (when missing to select a task in list) to lead to another. But the index ==-1 catches both of these actions so how differentiate?
I am also creating a list with the help of the text ínput dialog andi would like it sorted in alphabetical order after each time a new element is added. I found the sort function but I cannot find the place to insert it? If you understand what I am trying to say.
Edit Explanation about how the flows work.
It is a flow that after a finished phone call writes data about the call to a csv file. It has a subflow that gives you the opportunity to 3 choices by single choice. If you pick number 1 the flow is ended. Number 2 gives you a new single choice list (retrieved from task names written in a different csv file). That works fine. The value is written to/included in the data file where the call is logged. Choice number 3 in the first single choice list leads to a input text dialog, to be able to add a new item/element/value (not being used.before) to both the call log data file and to the task names file. It works also, but the task names file turns out written in input order instead of alphabetical order, making it hard to choose the right task after next phone call when it again is shown as a single choice list. .
Re: Single Choice dialog error???
Posted: 04 Mar 2014 17:13
by Martin
You can differentiate the two cases with variable
operation. The variable contains the value
ok,
cancel or
timeout depending how the dialog is closed.
You could check the operation in a condition
Expression, for example:
or alternatively use the AND operator:
This condition will continue to execute the flow on the true-branch, when OK was pressed AND a value was selected from the list.
You could also split the check into two conditions, one with
operation=="ok" and one with
index!=-1, and connect the two conditions accordingly.
You can sort a list with function
sort in a script. You have to read the text file first and build a list from the text.
-action
Init Variable Text File: to file_text
-action
Script with script:
Code: Select all
list = split(file_text, "\\n");
sort(list);
..then show the values in your input dialog:
-action
Input Dialog: {list,listformat,comma}
Re: Single Choice dialog error???
Posted: 04 Mar 2014 23:10
by angelatwork
Thanks a lot!