cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

MailChimp API - Expression Error 'field' of the record not found

Working with the MailChimp API and a field called "list_stats" didn't come through on a few records from the Campaign Summary. Unfortunatly I can't figure out how to transform the table prior to expanding.

 

I've tried

Table.ExpandColumns() without listing 'list_stats' in the function arguements but it still gave errors.

 

I tried to combine some learnings from this blog post  and another from this post. But this codes doesn't work because I'm not trying to transform a List but a Table

Table.TransformColumns(#"Filtered Rows",{{"Data", each List.Transform(_, each Record.SelectFields(_,{"list_stats"},MissingField.UseNull))}})

 

So far I have the basic stuff 

let
Source = MailChimp.TablesV2(),
campaigns = Source{[Key="campaigns"]}[Data],
#"Filtered Rows" = Table.SelectRows(campaigns, each ([Name] = "Campaign Summary")),
#"Removed Other Columns" = Table.SelectColumns(#"Filtered Rows",{"Data"}),
Data = #"Removed Other Columns"{0}[Data],

 errorexpression2.JPG

 

 

errorexpression.JPG

 

I know that @MarcelBeu could answer this but I may have used up my help requests for the week.

1 ACCEPTED SOLUTION

Accepted Solutions
Anonymous
Not applicable

Re: MailChimp API - Expression Error 'field' of the record not found

For now, I modified the query...instead of pulling the Campaign Summary UI endpoint I leveraged the Instance function

 

= #"MailChimp Instance"("/reports?since_send_time=2014-01-01&count=500")

 

It gives me the same number of results after I remove the error rows and the rows with "sent_time" = blank

View solution in original post

4 REPLIES 4
Moderator v-qiuyu-msft
Moderator

Re: MailChimp API - Expression Error 'field' of the record not found

Hi @Anonymous,

 

Can you share the results of the step "#"Removed Other Columns""? It seems the issue is the value can't be changed to record type. 

 

You can use below Query to check 14th row, if any column values different from others. 

 

let
Source = MailChimp.TablesV2(),
#"Filtered Rows" = Table.SelectRows(Source, each ([Name] = "Campaigns"))[Data]{0}
in
#"Filtered Rows"

 

Maybe @ImkeF @MarcelBeug have another good suggestions. 

 

Best Regards,
Qiuyun Yu 

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Re: MailChimp API - Expression Error 'field' of the record not found

Hey @v-qiuyu-msft

 

I modified the code slightly to pull just the campaign summary: = Table.SelectRows(Source, each ([Name] = "Campaign Summary"))[Data]{0}

 

but receive the error message "Expression Error: There weren't enough elements in the enumeration to complete the operation. Details: List"

 

The result of the Removed Other Columns is just a sigle table with The Data field and one value as Table, then if you try to expand the table you get the second screen shot with row 14 showing error. 

 

imagefilter.JPG

 

Some how it needs to modify all records in the table to include the "list_stats" if it doesn't already have it

Anonymous
Not applicable

Re: MailChimp API - Expression Error 'field' of the record not found

For now, I modified the query...instead of pulling the Campaign Summary UI endpoint I leveraged the Instance function

 

= #"MailChimp Instance"("/reports?since_send_time=2014-01-01&count=500")

 

It gives me the same number of results after I remove the error rows and the rows with "sent_time" = blank

View solution in original post

pvazig Visitor
Visitor

Re: MailChimp API - Expression Error 'field' of the record not found

I'm experiencing a similar issue with this. It is odd, because the query did worked two weeks ago and stop doing it without any changes on it when I updated the data manually this week. The difference with the OP is that I don't get the error on Power Query editor, but afterwards when updating the data. 

The error is the following: 

mailchimp query error.jpg

My user interface is set to Spanish, but the message translates to "Error of OLE DB or ODBC: [Expression.Error] The field 'list_stats' was not found on the registry."

 

I tried the accepted solution, but then I'm unable to run the query. So, this workaround does not seem to be working anymore (at least for my data). 

 

EDIT: I find the solution to my issue and (I think) the one from the OP. This error appears because one or more rows failed to load the record value for the 'list_stats' column, so I just added to my query the following code:

#"Remove errors" = Table.RemoveRowsWithErrors(#"QueryName", {"id"})

before the in #"QueryName"

 

With this your query should run correctly. 

Helpful resources

Announcements
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Users Online
Currently online: 276 members 3,168 guests
Please welcome our newest community members: