Forum Discussion

vivekjvs's avatar
vivekjvs
Frequent Visitor
2 years ago

Take input as list which can be null

Hi

 

I have a parameter of type list that can be null. Here is the code-

 

(a as list)=>
    let 
        b = if a is null then {""} else a
    in 
        b

 

And I am invoking the above function like this-

 

let
    Source = Query1(null)
in
    Source

 

The error I get if I run the above query-

 

Expression.Error: We cannot convert the value null to type List.
Details:
    Value=
    Type=[Type]

 


Can someone please tell me how I can pass null to a parameter of type list.

Thanks
Vivek

1 Reply

  • vivekjvs 

    Your function expects list as input that's why the error comes up. Provide the value as follows

     

     

    let
        Source = Query1({null})
    in
        Source