Forum Discussion
chriswragge
Helper I
7 years agoUsing PowerBI Parameters Names in .txt files, to build dynamic API queries
Hi there, I have a query that uses the PowerBI 'Web' source to pull reporting data from an API (POST method). I also have the client ID, client secrect, body, and token into seperate .txt files ...
- 7 years ago
I just worked it out myself using the same exact logic. You can use this in a function too. Glad you were able to get this working
let Source = (samplebinary as binary) => let Source = samplebinary, ConvertToText= Text.FromBinary(Source,1252), ReplaceParam1 = Text.Replace(ConvertToText,"var1", param1), ReplaceParam2 = Text.Replace(ReplaceParam1 ,"var2", param2) in ReplaceParam2 in Source
Nishantjain
Continued Contributor
7 years agoHey Chris
Ignore my previous message. I just realised that you sre trying to manipulate the binary. I am not sure if my suggestion would work
Ignore my previous message. I just realised that you sre trying to manipulate the binary. I am not sure if my suggestion would work
chriswragge
Helper I
7 years agoActually, I think I have it. It's really just as simple as
let
token = Text.FromBinary(Token,1252),
clientID = Text.FromBinary(ClientID,1252),
clientSecret = Text.FromBinary(ClientSecret,1252),
url = "https://analytics.adobe.io/api/"&clientID&"/reports",
body = Text.Replace(Text.Replace(Text.FromBinary(Visits,1252),"[var1]",Param1),"[var2]",Param2),- Nishantjain7 years ago
Continued Contributor
I just worked it out myself using the same exact logic. You can use this in a function too. Glad you were able to get this working
let Source = (samplebinary as binary) => let Source = samplebinary, ConvertToText= Text.FromBinary(Source,1252), ReplaceParam1 = Text.Replace(ConvertToText,"var1", param1), ReplaceParam2 = Text.Replace(ReplaceParam1 ,"var2", param2) in ReplaceParam2 in Source
- chriswragge7 years ago
Helper I
Thanks Nishantjain. Accepting your post as the solution as it put me in the right direction and answers the question.
Appreciate all the help!!