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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
al358
Frequent Visitor

Unable To Apply Query - OLE DB or ODBC error: [Expression:Error] expected a RenameOperations value

When I try to apply this query (see text file) I get the following error:

 

OLE DB or ODBC error: [Expression:Error] We expected a RenameOperations value

 

error.png

 

I think the error stems from the below formula:

 

Table.AddColumn(#"Sorted Rows", "Custom", each let
thisrecord = Json.Document([options_input]),
sortedrecord = Record.ReorderFields(thisrecord, List.Sort(Record.FieldNames(thisrecord))),
renamedrecord = Record.RenameFields(sortedrecord, List.Zip({Record.FieldNames(sortedrecord), {"Storage_Key", "Network_Key", "Condition_Key"}}))
in
renamedrecord)

 

Any ideas how I can resolve so I can apply my query to my model?

1 ACCEPTED SOLUTION

I'd probably choose to null all fields if there aren't exactly 3.

 

Something like this:

renamedrecord =
    if Record.FieldCount(sortedrecord) <> 3
    then [Storage_Key = null, Network_Key = null, Condition_Key = null]
    else Record.RenameFields(sortedrecord, <...existing code here...> )

View solution in original post

6 REPLIES 6
al358
Frequent Visitor

@AlexisOlson I think you're onto something there. There are some instances of thisrecord not having 3 fields.

 

How can I stop this from preventing me from applying my query to my model though?

Well, if you're missing fields, then it's hard to know how to rename the ones you do have and what to do for the remainder of the query where all three fields are referenced. How should this query work for such cases?

Instances where there are not 3 fields are edge cases (years-old entries made under a legacy system, which are unlikely to be included in any analysis).

 

A cursory glance at the legacy entries suggests there is never fewer than 3 fields, and I'm trying to think of the simplist solution to allow the query to apply to the model, so perhaps always name the first 3 fields as per the current query, and return a null value for subsequent fields?

 

Would that work? Or can you think of a more elegant solution?

I'd probably choose to null all fields if there aren't exactly 3.

 

Something like this:

renamedrecord =
    if Record.FieldCount(sortedrecord) <> 3
    then [Storage_Key = null, Network_Key = null, Condition_Key = null]
    else Record.RenameFields(sortedrecord, <...existing code here...> )

Alexis, you are indeed a Super User and a credit to the community; this worked perfectly! Thank you for your help.

AlexisOlson
Super User
Super User

It's hard to say without being able to see it in action, but if thisrecord has more or less than three fields, then I'd expect the renaming step to fail since you'd get invalid oldname/newname pair(s) from List.Zip.

Helpful resources

Announcements
October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors