Forum Discussion
M language issue
Thanks for your response Greg_Deckler! I am sure it is not a table--which is why it seems like either an odd bug or something--here is a snippet of code with comments:
//Prep for filter using a parameter (outboundcodes) which is just a comma-delimited list of values
//
//
valForCodes = Value.FromText(outboundcodes),
//This one works (hardcoded)
tblIncludeStates = Table.SelectRows(tblFromDownload, each List.Contains({543,95,96,1359,1360,1104,1170,1172,93,1248,454,1361,92,97,-4,-3,-5,-7,-8,-2}, [Outstate_Code])),
//This one doesn't (just results in an empty table
//
tblIncludeStates = Table.SelectRows(tblFromDownload, each List.Contains(valForCodes,[Outstate_Code])),
Try this:
//Prep for filter using a parameter (outboundcodes) which is just a comma-delimited list of values
//
//
valForCodes = Text.ToList(Value.FromText(outboundcodes)),
//This one works (hardcoded)
tblIncludeStates = Table.SelectRows(tblFromDownload, each List.Contains({543,95,96,1359,1360,1104,1170,1172,93,1248,454,1361,92,97,-4,-3,-5,-7,-8,-2}, [Outstate_Code])),
//This one doesn't (just results in an empty table
//
tblIncludeStates = Table.SelectRows(tblFromDownload, each List.Contains(valForCodes,[Outstate_Code])),- dslForPBI8 years agoHelper I
Right..tried that..as well as trying to convert it to binary first..you just get an empty table as a result (no errors, data is fine when viewed in the applied steps)..like the filtering suddenly doesn't work..only other thing I haven't tried is changing the encoding value when converting to binary first, like perhaps the text encoding is different with hand-input values within the advanced editor (is all I can think of)..
- Greg_Deckler8 years agoCommunity Champion
What does your raw data look like? Is it just that comma-delimited text or ? Can you post what your raw data looks like or an example/sample of what it looks like?
- dslForPBI8 years agoHelper I
..sure..so what's happening is as I showed in the previous snippet:
tblIncludeStates = Table.SelectRows(tblFromDownload, each List.Contains({543,95,96,1359,1360,1104,1170,1172,93,1248,454,1361,92,97,-4,-3,-5,-7,-8,-2}, [Outstate_Code])),
..this works fine when you have it like this on raw data like Outstate_Code = 543, Outstate_Ode = 95, etc (it includes the rows in output)..but if I try and use parameter "P1" where P1 = 543,95,96..it fails..I also figured out why Text.ToList fails because the list becomes:
5
4
3
,
9
5
...and so on.