Forum Discussion
List.Transform list of columns with return value with function which needs the actual columnName
Hey!
Is there any way that you can share a functional example M code that contains that list and what you're trying to achieve? wondering how your list actually looks like
- mrc_bob3 years agoRegular Visitor
I have one step with Table.ColumnNames which contains f.e. 3 columnsNames resourcetype, msdyn_startlocation,usertype.
This step is called OptionsetColumns and used in the List.Transform.
the each _ gives the value of the column f.e.669010000.
which I need as well the provide as the 1st parameter to the function but need the columns name like resourcetype as well.I will post some more details later. Now on my phone....
- DennesTorres3 years ago
Power Participant
Hi,
So, once again, I may be able to provide some guesses and hope they help:
If OptionsetColumns is already an array of columnNames, such as {"CustomerID", "Name", "Phone"},
the "_" on the first each, the 2n parameter of the List.Transform, is exactly the column name you want to retrieve.
For example, just to have a better view of the code, let me show a silly example:
List.Transform({"CustomerID", "Name", "Phone"}, each _ + "column")
May result in {"CustomerIDcolumn", "Namecolumn", "Phonecolumn"},
But instead of the array you have OptionsetColumns, but it's the same. The "_" on the first each has the column name and in this case I don't fully understand how your 2nd each is working...
Kind Regards,
Dennes- mrc_bob3 years agoRegular Visitor
So for this first each I had the idea already this is the column name.
within my function I need the value of the record within that column, "static entity name", "column name"
I beleave the second each gives me the value correct. But how do I get the column name of the first each again?