Forum Discussion
Inserting blank into a list ,
- 2 years ago
Please read post alist =
{ "a","a","a","a","b","b","b","b","c","c","c","d"} - 2 years ago
This perhaps?:
let alist = {"a","a","a","a","b","b","b","b","c","c","c","d"}, poslist = {1..List.Count(alist)-1} in List.Accumulate(poslist, {alist{0}}, (s,c)=> if alist{c} = alist{c-1} then s & {alist{c}} else s & {"",alist{c}})resulting in:
or use null instead of "".
No I , that is what it does, I want a better solution to getting the last value included ohter than just adding it on the end, I did say this in the originla post, please don't suggest alternativves as that is not the point I wans a conditons that will autmatically include the last value when ii is met or something somilar.
please show us what you have as a start (presumably alist) and what you want to get in the end. We don't need your code. Thanks.
- Dicken2 years agoPost Prodigy
Please read post alist =
{ "a","a","a","a","b","b","b","b","c","c","c","d"} - Dicken2 years agoPost Prodigy
and what I want at teh end =
{ "a","a","a","a","b","b","b","b","c","c","c","d"} ,but with a space inserted into between each but want to use an accumlation that does includes the last value as said I used
s & { alist {c} , "", List.Last( alist) } )
I think I've come up wiht a better way of including the last value.