Page 1 of 1

Add extra words

Posted: 10 Aug 2019 06:35
by Rafi4
Hi Martin and all
Is there any way to add extra words to a list or map.

For example
List=(good,cool,amazing);
Date=1565418759863,1565418769509,1565418989863
I want to add extra words to them e.g

good date [0],
cool date [1],
amazing date [2]
in message dialog. How can I?

thanks from record4

Re: Add extra words

Posted: 10 Aug 2019 16:48
by Desmanto
Do you mean to combine two list?

If you need to do operation between 2 or more list, make sure all of them have the same length. Then you can loop upon the index from 0 to the last element, do the operation (combine), and store it into new list.

Code: Select all

list = newList("good", "cool", "amazing");
date = newList(1565418759863, 1565418769509, 1565418989863);

show = newList();
for(i in [0 to length(list)-1])
  addElement(show, list[i] + " " + date[i]);

msg = "{show,listformat}"
use {msg} in the message dialog.

Re: Add extra words

Posted: 10 Aug 2019 17:17
by Rafi4
Hi Desmanto
Thanks a lot.
list =(1565418759863,1565418769509,1565418989863)

How can I add " dateformat, dd-MM-yyyy hh-mm a" to above values to show as

10-12-2019 10-26 p.m
10-12-2019 10-46 p.m
10-12-2019 10-36 p.m.

thanks from record4

Re: Add extra words

Posted: 10 Aug 2019 17:48
by Desmanto
I already guess you want to do that too :D Since you are going to use dateformat, it makes more sense just to use inline expression directly.

Code: Select all

list = newList("good", "cool", "amazing");
date = newList(1565418759863, 1565418769509, 1565418989863);

show = newList();
for(i in [0 to length(list)-1])
  addElement(show, "{list[i]} {date[i],dateformat,dd-MM-yyyy hh-mm a}");

msg = "{show,listformat}"
I remove the + and include the list into the inline expression.

Re: Add extra words

Posted: 10 Aug 2019 23:00
by Rafi4
Hi Desmanto
Working amazing. thanks from record4 .