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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

Getting error while creating multiple parameters using meta in a single function

I am trying to pass the list as a paramter in the API.contents() function for which I am creating a parameters function using meta. If I created a single parameter then it works fine but if I am creating a function for multiple parameters I get below error.

Sneha_thakur_0-1680172884879.png

What can i do to solve this issue. Any lead would be appreciated.

Code - 

section User_API_Param;

[DataSource.Kind="User_API_Param", Publish="User_API_Param.Publish"]
shared User_API_Param.Contents = Value.ReplaceType(parameters, ScopeType);

ScopeType = type function (
message as (type text meta [
Documentation.FieldCaption = "Limit",
Documentation.FieldDescription = "Enter a limit",
Documentation.SampleValues = {"1", "2"}
]),
name as (type list meta [
Documentation.FieldCaption = "limit range",
Documentation.AllowedValues = { "1", "2", "3" }
]))
as any;


parameters = (limit as text, optional limitrange as list) =>
let
accesstoken = Extension.CurrentCredential()[Key],
baseUrl = "https://api.example.com/",
endpoint = "/users",
Headers = [
Authorization = "Bearer " & accesstoken
],
source = Web.Contents(baseUrl,[RelativePath = endpoint & "?limit=" & limit, Headers = Headers, ManualCredentials = true]),
Value = Json.Document(source),
data = Value[data],
ToTable = Table.FromList(data, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
ExpandCol = Table.ExpandRecordColumn(ToTable, "Column1", {"id", "name", "email", "authType", "roles"}, {"id", "name", "email", "authType", "roles"}),
Roles = Table.ExpandListColumn(ExpandCol, "roles"),
RolesData = Table.ExpandRecordColumn(Roles, "roles", {"role"}, {"role"}),
ExtractRoles = Table.ExpandRecordColumn(RolesData, "role", {"id", "name"}, {"id.1", "name.1"}),
RenameRoles = Table.RenameColumns(ExtractRoles,{{"id.1", "Role_id"}, {"name.1", "Role"}})
in
RenameRoles;

// Data Source Kind description
User_API_Param = [
Authentication = [
Key = []
// UsernamePassword = [],
// Windows = [],
// Implicit = []
],
Label = Extension.LoadString("DataSourceLabel")
];

// Data Source UI publishing description
User_API_Param.Publish = [
Beta = true,
Category = "Other",
ButtonText = { Extension.LoadString("ButtonTitle"), Extension.LoadString("ButtonHelp") },
LearnMoreUrl = "https://powerbi.microsoft.com/",
SourceImage = User_API_Param.Icons,
SourceTypeImage = User_API_Param.Icons
];

User_API_Param.Icons = [
Icon16 = { Extension.Contents("User_API_Param16.png"), Extension.Contents("User_API_Param20.png"), Extension.Contents("User_API_Param24.png"), Extension.Contents("User_API_Param32.png") },
Icon32 = { Extension.Contents("User_API_Param32.png"), Extension.Contents("User_API_Param40.png"), Extension.Contents("User_API_Param48.png"), Extension.Contents("User_API_Param64.png") }
];

0 REPLIES 0

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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