Forum Discussion
Expression.Error: We cannot convert a value of type List to type Text.
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
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- ottiphi8 years agoHelper I
Hi Lydia,
the code seems to work perfectly fine! Everthything just looks like it should. Thank you so much vor you held! When I apply the query changes though, I get the message as shown below ("the 'ID 2' column does not exist in the rowset"). That is true! But I just pulled the data from a SharePoint-List and did not modify the amount of columns. Also I don't have the description "ID 2" for anything in my code. Can you help me here?
Best regards,
Philipp
- Anonymous8 years agoNot applicable
ottiphi,
In your scenario, delete the extract value step from code in Advanced Editor, then check if you can apply query changes successfully.
If there is no issue, extract values directly from UI following the guide in the screenshots below.
Regards,
Lydia