The Ellipsis/Not Implemented Error In M

Recently I was creating a parameter in Power BI Desktop and had it configured something like this:

image

I didn’t bother to choose anything in the Default Value dropdown box, and when I looked at the code for the parameter in the Advanced Editor I saw this:

"a" 
meta 
[IsParameterQuery=true, 
 List={"a", "b", "c"}, 
 DefaultValue=..., 
 Type="Text", 
 IsParameterQueryRequired=true]

I was interested to know what the ellipsis symbol (three dots …) in the DefaultValue field in the record meant, and looking in the Language Reference I found that in M it can be used for two purposes: as an open record marker (maybe something for a future blog post) and, as in this case, as a quick way of returning an error. The language reference says that it is directly equivalent to the following expression, which returns a “Not Implemented” error:

error Error.Record("Expression.Error", "Not Implemented")

But from what I can see, it actually returns a “Value was not specified” error instead. Here’s another example of how it can be used in a function definition, and what it returns:

let
    MyFunction = (x,y) => if x>y then true else ...,
    Output = MyFunction(0,1)
in
    Output

image

It’s not something I think I’ll be using in my own code, but it’s good to know what it means!

3 thoughts on “The Ellipsis/Not Implemented Error In M

  1. Hi Chris!
    Interesting findings. I always skipped this part as to foggy for me.

    I tried to check what does it mean “open record”, but cannot find any implementations. Moreover, I got some strange results during my searches. I tried to convert or create a record to open type, but failed. And then I understand that I do not familiar with type uses at all. For example,

    let
    a = [FieldName=”1.5″],
    b= Value.ReplaceType(a, type [OtherFieldName = number]),
    bType = Value.Type(b[OtherFieldName])
    in
    bType

    gives me a “text”, not “number”.
    Where is my error?

    • Hi Maxim, from reading the docs I understand that an open record is only applicable to record types, not records. So for example you can define a record type which is a description of the fields a record should have, and you can say that a function parameter should only accept a record with this structure; an open record just allows you to say that this record type must have some fields but may also have others. I’ll do some more research and blog about it in the future though.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s