Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
StephenButland
New Member

Expression.Error: We cannot convert a value of type Record to type Function.

I keep getting error "Expression.Error: We cannot convert a value of type Record to type Function." using the code below? 

 

let
BaseUrl = "https://someurl.com",
Since = #date(2018, 12, 10),
UnixSince = Number.ToText(Duration.TotalSeconds(Since-DateTime.Date(#datetime(1970, 1, 1, 0, 0, 0)))),
Source = Json.Document(Web.Contents(BaseUrl & "?since=" & UnixSince, [Headers=[#"X-User-Email"="Test.Email@.com", #"X-User-Token"="1111111111111111"]])),
metacode = Source[meta],
PageCount = metacode[total_pages],

GetJson = (Url) =>
let Options = [Headers=[#"X-User-Email"="Test.Email@.com", #"X-User-Token"="1111111111111111"]],
RawData = Web.Contents(Url, Options),
Json = Json.Document(RawData)
in Json,

GetPage = (Index) =>
let Page = "&page=" & Text.From(Index),
Url = BaseUrl & "?since=" & UnixSince & "&page=" & Page,
Json = Function.InvokeAfter(GetJson(Url), #duration(0,0,0,5)),
Value = Json[#"answers"]
in Value,

Indicies = { 1 .. PageCount},
Pages = List.Transform(Indicies, each GetPage(_)),
Entities = List.Union(Pages),
Table = Table.FromList(Entities, Splitter.SplitByNothing(), null, null, ExtraValues.Error)
in
Table

 

I'm at a loss why this is occurring and would appreciate any assistance. 

 

Thanks in advance.

1 ACCEPTED SOLUTION

Hi @v-shex-msft

 

You're correct, the query does require particular SSL credentials. 

 

The step that causes the issue appeared to be "Table = Table.FromList(Entities, Splitter.SplitByNothing(), null, null, ExtraValues.Error)".

 

After testing it actually turned out to be "Json = Function.InvokeAfter(GetJson(Url), #duration(0,0,0,5)),". It looks like my query didn't like the invoke after function? If completely honest I am not 100% sure why this would cause the issue but after removing the function and a little tweaking my query worked so I am very happy. 

 

Thank you for your response. 

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi everyone,

 

Please help me in this; I am getting bellow error. I am new to this.

 

Query I am using..............

 

let
   
    Source =  Json.Document(Web.Contents("https://mycompany.atlassian.net/rest/api/2/search?jql=filter=13330&startAt=0&maxResults=10000"),[Hea..."]])
in

    Source

 

Error I am getting:

 

Expression.Error: We cannot convert a value of type Record to type Number.
Details:
    Value=Record    Type=Type

 

 

Any help is greatly appreciated.

 

Kind regards..

v-shex-msft
Community Support
Community Support

Hi @StephenButland,

 

I test your query on my side but failed, it seems like your query require particular SSL credentials.

Can you confirm which steps caused the issue? You can click on step list to choose other query steps to check which steps cause this issue.

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Hi @v-shex-msft

 

You're correct, the query does require particular SSL credentials. 

 

The step that causes the issue appeared to be "Table = Table.FromList(Entities, Splitter.SplitByNothing(), null, null, ExtraValues.Error)".

 

After testing it actually turned out to be "Json = Function.InvokeAfter(GetJson(Url), #duration(0,0,0,5)),". It looks like my query didn't like the invoke after function? If completely honest I am not 100% sure why this would cause the issue but after removing the function and a little tweaking my query worked so I am very happy. 

 

Thank you for your response. 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.