Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

List of integers as parameter

Hi, I got a dataset that is too big for import.

 

I would like to define a parameter that can be used in a query. The parameter should be a list of integers that will be used in the query. The input paramter can for instance look like [100000,20000,30000] or {100000, 20000, 30000}

 

Assuming that the user inputs this list as a parameter. How can I create a list from this text-parameter, which I then can use to filter my query?

 

Can this be done in another way?

 

 

  • Anonymous's avatar
    Anonymous
    5 years ago

    For future reference, here is a solution. 

     

    1) Create a parameter of type text, name=ImoList. The user inputs a comma seperated list of integers "1000,2000,3000,...."

    2) Create a new query (MyList) with the following content

     

    let
        Source = Text.Split(ImoList,","),
        #"Out"=List.Transform(Source,each Number.FromText(_))
    in
        #"Out"

     

    3) Use the list for filtering

     

    #"Filtered Rows1" = Table.SelectRows(#"Renamed Columns", each (List.Contains(MyList,[imo])))

     

      

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Seems like inputing on the format "1000,2000,3000" and using Text.Split(inputParameter,",") works

  • Anonymous's avatar
    Anonymous
    Not applicable

    For future reference, here is a solution. 

     

    1) Create a parameter of type text, name=ImoList. The user inputs a comma seperated list of integers "1000,2000,3000,...."

    2) Create a new query (MyList) with the following content

     

    let
        Source = Text.Split(ImoList,","),
        #"Out"=List.Transform(Source,each Number.FromText(_))
    in
        #"Out"

     

    3) Use the list for filtering

     

    #"Filtered Rows1" = Table.SelectRows(#"Renamed Columns", each (List.Contains(MyList,[imo])))