Page 1 of 1

Elements of a list not correctly shown in Eingabedialog

Posted: 21 Apr 2013 08:56
by xxx
Hi,

if you want to show elements of a list (list=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) in Eingabedialog, elements will be showed this way:

[1
2
3
4
5
6
7
8
9
10]

If you use the variable 'value' (=selected element),
it includes '[' and ']' and ' ' (=space).
Therefore you have to use the following syntax to show the elements correctly:
{replace(replace(replace(list,"[",""),"]","")," ","")}

It would be better without this work around.

http://automagic4android.com/flow.php?i ... daa1cf2018

Re: Elements of a list not correctly shown in Eingabedialog

Posted: 21 Apr 2013 13:37
by LightTempler
Looks like elements gots handled as strings in your way of definition.
The [ and ] becomes part of the list entry.

The only time I 've used a list in Automagic I defined this way

mylist = newlist("Element1", "Element2", ...)

which works good for me.

LiTe

Re: Elements of a list not correctly shown in Eingabedialog

Posted: 21 Apr 2013 15:00
by bobchernow
Just tried it with addElement and it gets same incorrect result. May be bug in input dialog?

Re: Elements of a list not correctly shown in Eingabedialog

Posted: 22 Apr 2013 10:33
by Martin
The field "list values" in the action input dialog accepts a list of comma separated values:
val1,val2,val3,"val with comma a, inside"
shows (for type=Single Choice):
val1
val2
val3
val with a comma, inside

Assume you have created a list with numeric values somewhere in a script:
list_xyz = [1 to 10];
or
list_xyz = newList("a", "b", "c");

You can show a single choice input dialog like this (type=Single Choice):
{list_xyz,listformat,comma}
This will convert the list to the comma separated values syntax (also handles escaping of commas in the values of the list).

Martin

Re: Elements of a list not correctly shown in Eingabedialog

Posted: 23 Apr 2013 17:36
by xxx
Hi Martin,

it works.
Thank you.