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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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