Get certified for free when you join Fabric Data Days 2026 and dive into Fabric, Power BI, SQL, AI, and other essential data skills.
Join nowTry your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join now
Hello
I have this sample of custom connector
But when i test it ihave this error message
7 arguments ont été passés à une fonction qui en attendait entre 1 et 2.
But i don't know where is my error exactly
[Version = "1.0.0"]
section DirectSQL;
// Définissez d'abord la fonction GetOdbcDataSource
GetOdbcDataSource = (server as text, database as text) as table =>
let
ConnectionString = [
Driver = "SQL Server Native Client 11.0",
Server = server,
Database = database
],
Credential = Extension.CurrentCredential(),
CredentialConnectionString =
if (Credential[AuthenticationKind]?) = "UsernamePassword" then
[UID = Credential[Username], PWD = Credential[Password]]
else if (Credential[AuthenticationKind]?) = "Windows" then
[Trusted_Connection = "Yes"]
else
error "Unknown authentication kind",
OdbcOptions = [
CredentialConnectionString = CredentialConnectionString,
ClientConnectionPooling = true,
HierarchicalNavigation = true,
SqlCapabilities = [
SupportsTop = true,
Sql92Conformance = 8,
GroupByCapabilities = 4,
FractionalSecondsScale = 3
],
SoftNumbers = true,
HideNativeQuery = true,
SQLGetInfo = [
SQL_SQL92_PREDICATES = 0x0000FFFF,
SQL_AGGREGATE_FUNCTIONS = 0xFF
]
],
OdbcDataSource = Odbc.DataSource(ConnectionString, OdbcOptions)
in
OdbcDataSource{[Name = database]}[Data];
// Ensuite, définissez les fonctions GetTable, GetArticleTable et GetClientTable
GetTable = (server as text, database as text, schemaName as text, tableName as text, columnNames as list) =>
let
Source = GetOdbcDataSource(server, database),
dbo_Schema = Source{[Name = schemaName, Kind = "Schema"]}[Data],
table = dbo_Schema{[Name = tableName, Kind = "Table"]}[Data],
filteredTable = Table.SelectColumns(table, columnNames)
in
filteredTable;
GetArticleTable = (server as text, database as text) =>
GetTable(server, database, "dbo", "F_Article", {"AR_Ref", "AR_Design"});
GetClientTable = (server as text, database as text) =>
GetTable(server, database, "dbo", "F_Comptet", {"CT_Num", "CT_Intitule"});
// Définissez votre source de données DirectSQL.Database
[DataSource.Kind = "DirectSQL", Publish = "DirectSQL.UI"]
shared DirectSQL.Database = (server as text, database as text) as table =>
let
// Appel à GetArticleTable avec les arguments server et database
articleTable = GetArticleTable(server, database),
// Appel à GetClientTable avec les arguments server et database
clientTable = GetClientTable(server, database),
// Créez la table de navigation en utilisant les résultats des appels précédents
navTable = #table(
{"Name", "Data", "ItemKind", "ItemName", "IsLeaf"}, {
{ "Client", clientTable, "Table", "Table", true },
{ "Article", articleTable, "Table", "Table", true }
}
)
in
navTable;
// Définition de votre connecteur DirectSQL
DirectSQL = [
TestConnection = (dataSourcePath) =>
let
json = Json.Document(dataSourcePath), server = json[server], database = json[database]
in
{"DirectSQL.Database", server, database},
Authentication = [
Windows = [],
UsernamePassword = []
],
Label = "Direct Query for SQL APBS",
// This sample doesn't enable the use of SSL.
SupportsEncryption = false
];
// Définition de l'exportation UI de votre connecteur
DirectSQL.UI = [
// enables direct query
SupportsDirectQuery = false,
Beta = true,
Category = "Database",
ButtonText = {"APBS Sage 100c", "APBS Sage 100c Connector"},
SourceImage = DirectSQL.Icons,
SourceTypeImage = DirectSQL.Icons
];
// Définition des icônes pour votre connecteur
DirectSQL.Icons = [
Icon16 = {
Extension.Contents("DirectQueryForSQL16.png"),
Extension.Contents("DirectQueryForSQL20.png"),
Extension.Contents("DirectQueryForSQL24.png"),
Extension.Contents("DirectQueryForSQL32.png")
},
Icon32 = {
Extension.Contents("DirectQueryForSQL32.png"),
Extension.Contents("DirectQueryForSQL40.png"),
Extension.Contents("DirectQueryForSQL48.png"),
Extension.Contents("DirectQueryForSQL64.png")
}
];
| User | Count |
|---|---|
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 |