Elements of a list not correctly shown in Eingabedialog

Post your questions and help other users.

Moderator: Martin

Post Reply
xxx
Posts: 39
Joined: 18 Mar 2013 18:51

Elements of a list not correctly shown in Eingabedialog

Post by xxx » 21 Apr 2013 08:56

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

LightTempler
Posts: 53
Joined: 17 Mar 2013 16:08

Re: Elements of a list not correctly shown in Eingabedialog

Post by LightTempler » 21 Apr 2013 13:37

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

bobchernow
Posts: 56
Joined: 16 Mar 2013 14:10

Re: Elements of a list not correctly shown in Eingabedialog

Post by bobchernow » 21 Apr 2013 15:00

Just tried it with addElement and it gets same incorrect result. May be bug in input dialog?

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Elements of a list not correctly shown in Eingabedialog

Post by Martin » 22 Apr 2013 10:33

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

xxx
Posts: 39
Joined: 18 Mar 2013 18:51

Re: Elements of a list not correctly shown in Eingabedialog

Post by xxx » 23 Apr 2013 17:36

Hi Martin,

it works.
Thank you.

Post Reply