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
Anonymous
Not applicable

CustomConnector refresh problem

Hello Everyone,

 

I have a quick question on Dataset Refresh in Power BI Service. I have created a Custom Connector, and set up the on-premises data gateway(Personal mode) for the Scheduled Refresh. 

 

Note: I have included "TestConnection" in Code part as "TestConnection = (dataSourcePath) => { "CubeConnector.Contents" },"

 

The error which I am facing is as below: Its given in German Language, Error: "It says 0 Argument is given to Function, but it expects the Arguments between 4 and 5". 

 

"Same Error I am getting when I execute the Custom Connector in Visual studio also.

 

Kindly provide some suggestion on this issue. 

 

Arguments-Failing-Error.png

5 REPLIES 5
Greg_Deckler
Super User
Super User

@Anonymous - Can you paste your M code from Advanced Editor?

 

Otherwise, You could check the Issues forum here:

https://community.powerbi.com/t5/Issues/idb-p/Issues

And if it is not there, then you could post it.

If you have Pro account you could try to open a support ticket. If you have a Pro account it is free. Go to https://support.powerbi.com. Scroll down and click "CREATE SUPPORT TICKET".


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Hello @Greg_Deckler,

 

Thanks for your reply. I have raised the Support Ticket 

 https://community.powerbi.com/t5/Issues/Parameters-not-Visible-on-DataSet-Refresh-in-PBI-Service/idi... 

 

I have a problem with Parameters on DataSet Refresh in PBI Service for the Custom Connector. I set the Parameters in PBI Desktop under 'Manage Parameters'.  

 

But When I give the static (HardCoded) values in CustomConnector, Refresh working perfectly in PBI Service.  

 

Note: In PBI Desktop, Refresh on CustomConnector works perfectly. Problem is only on PBI Service with 'Parameters'. 

 

Here is my code:

shared CubeConnector.Contents = (Host as text, Port as number, Cube as text, Ansicht as text, optional Sprache as text) =>
let
lang = if (Sprache <> null) then Sprache else "L02",
// Restapi Query to fetch TM1 Data
url = "http://"& Host &":"& Number.ToText(Port) &"/api/v1/",
body = "{

}",

Source = Json.Document(Web.Contents(url, [Headers=[#"Content-Type"="application/json"], Content = Text.ToBinary(body), RelativePath = "Cubes('"& Cube &"')/Views('"& Ansicht &"')/tm1.Execute?$expand=Axes($expand=Hierarchies($select=Name),Tuples($expand=Members($select=Attributes/"&lang&"))),Cells($select=Value)"

])),

followed by some transformation which converts the cube data into the required Table Format.

Below is the input prompt for my custom connector in PBI Desktop:

CustomConnctorInput - Power BI Desktop.png

Here is the query and Parameters

 

Parameter.png

What am doing wrong, why In PBI Service there is no Parameter been set. Any Suggestions?

 

Hi @Anonymous ,

 

Would you please try to use  Skip Test Connection option in data source settings:

 

Capture.PNG

 

After you publish to the Power BI Service you will not be able to refresh your dataset unless you turn on the “Skip Test Connection”, because the Power BI Service apparently strips out any query parameters from the url when it is testing the connection. 

 

For more details, please refer to  https://blog.crossjoin.co.uk/2019/04/25/skip-test-connection-power-bi-refresh-failures/  and https://blog.crossjoin.co.uk/2016/08/23/web-contents-m-functions-and-dataset-refresh-errors-in-power-bi/

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Best Regards,

Dedmon Dai

Anonymous
Not applicable

Hi @v-deddai1-msft , 

 

Thanks for you reply. But I can't see "skip connection" option in 'DataSource Credentials window'.

Note: In custom connector code I have added: TestConnection = (dataSourcePath) => { "CubeConnector.Contents" }  in Data Scourc Kind descption section. 

 

PBI.png

One of my major problem is, Parameter are not visible[^^warning!^^ Parameters haven't been defined for this dataset yet. If you want to set parameters, use the Query Editor. Learn more], and I am using the on-premise-Gateway(Personal Mode). 

  Parameters-Power BI.png

Is that the problem with on-premise-Gateway(Personal Mode)? Should I need to install the other one and try?  

 

 

 

Hi @Anonymous ,

 

Would you please try to set all the parameters' data type to text? And  Woud you please try the following steps:

 

  1. delete your dataset from the service
  2. open the desktop file and hit Refresh 
  3. Use GetData from the service to publish the desktop model again

If the issue is still existing , please try to open a support ticket. If you have a Pro account it is free. Go to https://support.powerbi.com. Scroll down and click "CREATE SUPPORT TICKET".

 

Best Regards,

Dedmon Dai

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.

Top Solution Authors
Top Kudoed Authors