Forum Discussion
Expression.Error: We cannot convert a value of type List to type Text.
Hello. I already had that idea. Can you specify a little bit more and maybe write a lign of code that I could use? I am not a coder! Also, where exactly should I insert the function?
- Greg_Deckler8 years agoCommunity Champion
You should be able to put it whereever in your query, open up Advanced Editor and add a line. Here is an example function I wrote that you can take a look at:
let fnCombine = () => let values = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F" }, Result = Text.Combine(values,",") in Result in fnCombineAlso, here it is as a generic function that you should be able to use. Just add a Blank Query, paste in the code below, save function. Add Column -> Invoke Custom Function and send it your column that is a list as its parameter.
let fnCombine = (values as list) => let Result = Text.Combine(values,",") in Result in fnCombine- ottiphi8 years agoHelper I
Hello,
Thank you for your detailed explaination. I tried what you told me and used the generic function. Unfortunately it didn't work. Here is the code of the query I hava so far. Can I add a line within this query, that transforms the list within the cells into text?Probably before the changed type line, since after that line, there is not written List within the cells of the columns "hashtag" and "category" anymore, but Error. I would prefer not to open up a new query.
let
Source = SharePoint.Tables("https://hilti.sharepoint.com/sites/de001101", [ApiVersion = 15]),
#"3860ef3e-aef8-4ee7-bc63-1c29b67a7e9f" = Source{[Id="3860ef3e-aef8-4ee7-bc63-1c29b67a7e9f"]}[Items],
#"Changed Type" = Table.TransformColumnTypes(Custom1,{{"Idea Title", type text}, {"Date of Idea Entry", type date}, {"Submitter", type text}, {"Hashtag", type text}, {"Mealsize", type text}, {"Idea Status", type text}, {"Ranking of Idea", type text}, {"Meal Size", type text}, {"Implementierung", type text}, {"Category", type text}, {"Hashtag", type text}}),
#"Removed Blank Rows" = Table.SelectRows(#"Changed Type", each not List.IsEmpty(List.RemoveMatchingItems(Record.FieldValues(_), {"", null})))
in
#"Removed Blank Rows"Also, I will create two new queries afterwards, to reorganize the columns "hashtag" and "category". One example for hashtag:
let Source = IdeaList, #"Select Columns" = Table.SelectColumns(Source,{"Idea Title", "Hashtag"}), #"Split Column by Delimiter" = Table.ExpandListColumn(Table.TransformColumns(#"Select Columns", {{"Hashtag", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "Hashtag"), #"Trimmed Text" = Table.TransformColumns(#"Split Column by Delimiter",{{"Hashtag", Text.Trim, type text}}) in #"Trimmed Text"I did not write that code...
- Anonymous8 years agoNot applicable
ottiphi,
Add a "Extract values" step before change type and check if you get expected result.#"Extracted Values" = Table.TransformColumns(#"3860ef3e-aef8-4ee7-bc63-1c29b67a7e9f", {"Hashtag", each Text.Combine(List.Transform(_, Text.From), ","), type text})
There is an example for your reference.
Regards,
Lydia