Forum Discussion
LIst Generate ; to insert at given position
- Anonymous1 year ago
Hi Dicken ,
Just wanted to check and make sure everything is working good with the solution you shared. It looks like a solid approach, and I am really glad you found a way to use List.Generate to solve your issue.
Is it meeting your needs so far? If there is anything else you would like to adjust or if you run into any other challenges, feel free to reach out .We happy to help further.
Thank you.
To offer a sort of answer to my own question, I had want to use actrual number positons with generate ,
rather than a true false approach , but this does work, I have used null but ideally would create blank record,
[ reclist = Table.ToRecords(Source) ,
poslist = {"F", "K", "N"} ,
gen = List.Generate( ()=> [
x = 0, y = reclist{0} , z = {y} ] ,
each [x] < List.Count( reclist) ,
each [ x = [x] + 1, y = reclist{x} , z =
if List.Contains( poslist, Record.Field( y, "Item"))
then { y,null} else {y} ] ,
each [z] ) ,
result = List.Combine( gen ) ] [result]
Richard.
- Anonymous1 year agoNot applicable
Hi Dicken ,
Just wanted to check and make sure everything is working good with the solution you shared. It looks like a solid approach, and I am really glad you found a way to use List.Generate to solve your issue.
Is it meeting your needs so far? If there is anything else you would like to adjust or if you run into any other challenges, feel free to reach out .We happy to help further.
Thank you.- Dicken1 year agoPost Prodigy
Yes, one thing, if posting code, I feel i should use tags as it would make easier for people to read,
would you recommend ?