Forum Discussion
DataFormat.Error: We cannot convert the specified value to the specified type.
Did you ever find a resolution to this problem? I'm having the same issue on an object which didn't previously have any errors.
- Anonymous10 years agoNot applicable
I've the same issue. Was anybody able to fix it?
Regards,
Francesco
- Evogelpohl10 years agoHelper V
Anonymous & Bjoern.
I have this problem getting data from a custom object in a SalesForce (SF) table.
Here's how I solved my issue - Hope this helps you:
1) Query to get just the column names, so i can pass that to a function that finds the offending column with the data type that PowerQuery (PQ) can't deal with.
let Source = Salesforce.Data(), MyTable_c = Source{[Name="MyTable_c"]}[Data], LSTHeaders = Table.ColumnNames(MyTable_c), LST2Table = Table.FromList(LSTHeaders, Splitter.SplitByNothing(), null, null, ExtraValues.Error) in LST2Table2) Write a function to pass each column (i had 175) and get back just the first row - using "TRY" - this told me what column error'ed out.
let fnMCRColName = (MCRColName as text) => let Source = Salesforce.Data(), Source2 = Source{[Name="MyTable__c"]}[Data], LSTHeaders = Table.ColumnNames(Source2), FinalTable = Table.SelectColumns( Source2, { MCRColName } ), FirstRow = Table.First(FinalTable) in FirstRow in fnMCRColName3.
Add column to the first query results using the TRY function: Try fnLookup(querylist_colnames)
4.
Expand the custome record - you should see something like this:
5. You can see I have a GeoLocation_c column in my customer SF ojbect that PQ probably doesn't like. I've tried casting it to TEXT, but that doesn't work.
I'm going to update my query to remove that column
Eric.
- Evogelpohl10 years agoHelper V
I was able to remove the offending column w/ this code. I no longer get the error. Perhaps this GoeLocation column is some type of derived or component field for SalesForce and PowerBI can't convert it.
let Source = Salesforce.Data(), MyTable__c = Source{[Name="MyTable__c"]}[Data], ColRemoveGeo = List.Select(Table.ColumnNames(MyTable__c), each Text.StartsWith(_, "GeoLocat")), FinalMCRTable = Table.RemoveColumns(MyTable__c, ColRemoveGeo) in FinalMCRTable