cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted

Passing Parameters/Variables in Advanced Editor and R Script (e.g. Facebook Tokens)

Dear Community,

 

I routinely pull insights data from our institution's facebook page. This involves updated the page access token each time. As I have 3~4 queries, it's a kind of a minor pain to have to manually replace the FB token each time.

Is there a way to declare the token and have it passed through or stored as a variable to be used in each query?

I've shared my code snipped (used Rfacebook package because I think PowerBI has unfortunately abandoned their canned facebook connector >:-( .... 02.JPG01.JPG

 

Thanks.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Passing Parameters/Variables in Advanced Editor and RScript (e.g. Facebook Tokens)

sorry i was not aware it is a R query, here is another post on this forum. hopefully it is helpful.

 

https://community.powerbi.com/t5/Integrations-with-Files-and/How-to-pass-query-parameter-to-Data-Que...






Did I answer your question? Mark my post as a solution.

Proud to be a Datanaut! Appreciate your Kudos Smiley Happy
Feel free to email me with any of your BI needs.





5 REPLIES 5
Super User
Super User

Re: Passing Parameters/Variables in Advanced Editor (e.g. Facebook Tokens)

Yes you can do this, create a paremeter by following steps:

 

- click edit query

- click manage parmaeters and add new parameter lets' call it Facebook Token

 

in advance editor, replace your token value with your parmater like this #"Facebook Token"






Did I answer your question? Mark my post as a solution.

Proud to be a Datanaut! Appreciate your Kudos Smiley Happy
Feel free to email me with any of your BI needs.





Re: Passing Parameters/Variables in Advanced Editor and R Script (e.g. Facebook Tokens)

Like this?03.JPG

 

Does it need the hashtag?

Super User
Super User

Re: Passing Parameters/Variables in Advanced Editor (e.g. Facebook Tokens)

Yes it does, do you have space between your parmater name or not? It exactly matches with your parameter name,






Did I answer your question? Mark my post as a solution.

Proud to be a Datanaut! Appreciate your Kudos Smiley Happy
Feel free to email me with any of your BI needs.





Re: Passing Parameters/Variables in Advanced Editor and RScript (e.g. Facebook Tokens)

No I named my parameter without the space. 

I tried it with a tail hashtag too Smiley Sad

Maybe it doesn't work in RScript? Smiley Sad

 

This is the RScript Error:

Error in callAPI(url = x, token = token) :
argument "token" is missing, with no default
Calls: getInsights -> lapply -> FUN -> callAPI
Execution halted

Super User
Super User

Re: Passing Parameters/Variables in Advanced Editor and RScript (e.g. Facebook Tokens)

sorry i was not aware it is a R query, here is another post on this forum. hopefully it is helpful.

 

https://community.powerbi.com/t5/Integrations-with-Files-and/How-to-pass-query-parameter-to-Data-Que...






Did I answer your question? Mark my post as a solution.

Proud to be a Datanaut! Appreciate your Kudos Smiley Happy
Feel free to email me with any of your BI needs.





Helpful resources

Announcements
Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Summit North America

Power Platform Summit North America

Register by September 5 to save $200

Virtual Launch Event

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Users Online
Currently online: 414 members 4,411 guests
Please welcome our newest community members: