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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Powerwoman
Helper I
Helper I

Dynamics365BusinessCentral.ApiContentsWithOptions Content Language

Hi there,

I'm connecting Power BI to Business Central Cloud.
It would be great to receive content like the document type in a certain language, e.g. German.

Any ideas how to change/set the language in the connector?

Powerwoman_0-1674472075035.png

Thanks a lot!

1 ACCEPTED SOLUTION

I got response from Microsoft. Using the ODATA - connector worked fine for me.

 

Microsoft:

When we built the Business Central connector for Power BI, we decided to not use the current Power BI user language in our queries to the Business Central backend. There are a few reasons for this, but the main one is to avoid issues with filters, and also the fact that it would solve translation only for Power BI Desktop (Power BI Online always uses EN-US anyway).

 

Business Central OData web services and APIs default to the english-US language when no language is specified, so the result of the web service or API call will always run in a session with english-US as the user language.

 

This can be overwritten by adding a HTTP header to the API call, but we don't offer a good support for this in our connector unfortunately.

 

So, if you need this, you will have to use the OData.Feed connector instead.

 

Here is an example of what you could use to get results in Italian (adjust it for your case). Unfortunately, you will have to hardcode a specific language in the query.

I also added some freebies, such as setting a different timeout and changing the max page size. You don't really need these to change the language, you only need the Accept Language header, but I still suggest to keep the other values as they are in my example 🙂

 

let

Source = OData.Feed(

"https://api.businesscentral.dynamics.com/v2.0/527590bd-e6e8-422c-b8df-8613feff8a38/PRODUCTION/api/v2...",

null,

[

ODataVersion = 4,

Implementation = "2.0",

Timeout = Duration.FromText("00:08:00"),

Query = [],

Headers = [Prefer = "odata.maxpagesize=5000", #"Accept-Language" = "it-it"]

]

)

in

Source

View solution in original post

11 REPLIES 11
sgeheeb
Helper II
Helper II

Has anyone found a solution to this? As far as I am able to see there is no paramter "Culture" in the advanced options:

sgeheeb_0-1690969150981.png

 

Setting the parameter manually also does not work:

let
  Quelle = Dynamics365BusinessCentral.ApiContentsWithOptions(null, null, null, [UseReadOnlyReplica = true, Culture = "de-DE"]),
 
A solution would be much appreciated, I'd hate to translate all the enum values manually 😄

 

Hi sgeheeb,

 

Have you checked the language of the enum values that you get back from the API? I might be wrong, but I seem to think that you get (or, can get) english language enum values back. The other option is to leverage a "Page Query" to return the integer value of the enum, instead of the enum text itself. The downside of that is that page queries are not as performant.

Hello Ragnar,

I would like to stick with the API Query if possible. Currently, the API is returning the english enum

values, I'd like to get the German ones.

https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-connect-ap...

There's definitly the "Accept-Language" Header, which should to what I need it to do. I just don't know where to put it in Power Query.

This is the code which Power Query uses:

Quelle = Dynamics365BusinessCentral.ApiContentsWithOptions(null, null, null, [UseReadOnlyReplica= true]),

The three NULLs are:

1. Environment

2. Company

3. API Route

This won't help us.

So the Header information has to go in the "UseReadOnlyReplica" section. But where? I have tried thins like:

Quelle = Dynamics365BusinessCentral.ApiContentsWithOptions(null, null, null, [UseReadOnlyReplica = true, #"Accept-Language" = "de-DE"]),

and

Quelle = Dynamics365BusinessCentral.ApiContentsWithOptions(null, null, null, [UseReadOnlyReplica = true, Headers = [#"Accept-Language" = "de-DE"]]),

No luck so far.

So generally speaking, does anyone know how to add a header to the API-Call Power Query makes?

 

I had a look at the actual call and I can't even find the reference to the "ReadOnlyReplica" Option:

sgeheeb_0-1690976930998.png

 

RagnarE
Frequent Visitor

I wonder if this documentation might be of any help to you: https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-connect-ap...

 

I suppose that to test this you would have to play around with Postman or a similar tool, and I'm not sure how this would translate into Power Query. I'd hate to use anything but the BC connector, but if forced... 

Powerwoman
Helper I
Helper I

Hi Ragnar,
thanks for your response.

 

First of all, there's no 'Add parameter' field in the Business Central Connector.

 

Powerwoman_3-1678435015420.png

So you need to use the ODATA-Connector,  but unfortunately it didn't work.

 

I created the parameter:

Powerwoman_2-1678434841954.png

 

Used it in the ODATA Connector:

Powerwoman_0-1678434797656.png

 

Result:

Powerwoman_1-1678434822101.png

But thanks for your idea! 😀

Hi again,

 

I haven't had a chance to test this properly myself, but maybe you can. How about if you start your query with this:
= Dynamics365BusinessCentral.ApiContentsWithOptions(null, null, null,

[

UseReadOnlyReplica=Replica,
Headers = [#"Accept-Language" = "en-US"]

]
)

I´ll admit that there's a good chance that the connector simply ignores this extra parameter, but it also doesn't spit out an error. I'd be very curious to know if it does change anything in BC instance in German 🙂

Let me just quickly add that "Replica" in the code above is simply a parameter which can be set to true or false. Replica could thus be replaced by a simple true.

Hi Ragnar,

thanks for your quick response 😀


I used your Connector and Code:

Source = Dynamics365BusinessCentral.ApiContentsWithOptions(null, null, null, [ UseReadOnlyReplica = true, Headers = [#"Accept-Language" = "de-DE"] ] ),

 

But it seems like PowerBI is just simply ignoring this new parameter:

Powerwoman_1-1678443221887.png


I had a quick check on the BC environment settings - but they are set to German local settings 

 

Powerwoman_0-1678443148935.png

But thanks again for you input!

I got response from Microsoft. Using the ODATA - connector worked fine for me.

 

Microsoft:

When we built the Business Central connector for Power BI, we decided to not use the current Power BI user language in our queries to the Business Central backend. There are a few reasons for this, but the main one is to avoid issues with filters, and also the fact that it would solve translation only for Power BI Desktop (Power BI Online always uses EN-US anyway).

 

Business Central OData web services and APIs default to the english-US language when no language is specified, so the result of the web service or API call will always run in a session with english-US as the user language.

 

This can be overwritten by adding a HTTP header to the API call, but we don't offer a good support for this in our connector unfortunately.

 

So, if you need this, you will have to use the OData.Feed connector instead.

 

Here is an example of what you could use to get results in Italian (adjust it for your case). Unfortunately, you will have to hardcode a specific language in the query.

I also added some freebies, such as setting a different timeout and changing the max page size. You don't really need these to change the language, you only need the Accept Language header, but I still suggest to keep the other values as they are in my example 🙂

 

let

Source = OData.Feed(

"https://api.businesscentral.dynamics.com/v2.0/527590bd-e6e8-422c-b8df-8613feff8a38/PRODUCTION/api/v2...",

null,

[

ODataVersion = 4,

Implementation = "2.0",

Timeout = Duration.FromText("00:08:00"),

Query = [],

Headers = [Prefer = "odata.maxpagesize=5000", #"Accept-Language" = "it-it"]

]

)

in

Source

Thanks! I will give it a shot!

RagnarE
Frequent Visitor

Hi.

 

I was sad to see that you haven't had a response as I'm grappling with the same thing. A colleague sent me this from ChatGPT but I haven't quite figured out how to actually do this:

RagnarE_0-1678185438036.png

 

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors
Top Kudoed Authors