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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
FrugalEconomist
Helper III
Helper III

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

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...



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

5 REPLIES 5
parry2k
Super User
Super User

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"



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Like this?03.JPG

 

Does it need the hashtag?

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



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

No I named my parameter without the space. 

I tried it with a tail hashtag too 😞

Maybe it doesn't work in RScript? 😞

 

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

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...



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

Check out the October 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

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