Forum Discussion
XML parameter not working in embed paginated report URL
Hi, I am trying to pass xml as parameter in embed url as rp variable though my asp.net framework application level.
Please can you help me with this.
string P_ID = '<Pr><id>25</id><id>32</id></Pr>';
string parameters = $"&rp:P_IDS={P_ID}&rp:START_DATE={START_DATE}&rp:END_DATE={END_DATE}";
EmbedUrl = embedInfo.embedUrl + parameters;
5 Replies
- v-menakakotaCommunity Support
Hi Anonymous ,
Thanks for reaching out to the Microsoft fabric community forum.
It looks like the issue might be due to special characters in your XML string. When passing XML as a parameter in a URL, make sure the value is properly encoded. Also, confirm that your paginated report is set up to accept and handle XML input.
And also please go through the below documents which may help you in resolving the issue
https://learn.microsoft.com/en-us/power-bi/paginated-reports/parameters/pass-report-parameter-url
If I misunderstand your needs or you still have problems on it, please feel free to let us know.Best Regards,
Community Support Team- v-menakakotaCommunity Support
Hi Anonymous ,
I hope the information provided above assists you in resolving the issue. If you have any additional questions or concerns, please do not hesitate to contact us. We are here to support you and will be happy to help with any further assistance you may need.
Thank you.- v-menakakotaCommunity Support
Hi Anonymous ,
I hope the above details help you fix the issue. If you still have any questions or need more help, feel free to reach out. We’re always here to support you .
Thank you.
- SolomonovAntonSuper User
Why the raw XML fails
- Characters such as <, >, & and quotes have reserved meanings in a URL. They must be percent-encoded; otherwise the service truncates or rejects the query-string.
- Paginated Report parameters are always received as plain text. If you send an XML fragment you’ll parse it later in the dataset/query.
Recommended approach
- In the report:
- Create parameter P_IDS as type Text, allow blank.
- Inside the dataset (SQL Server example) turn the string back into XML:
DECLARE @xml xml = @P_IDS; SELECT x.i.value('.', 'int') AS ID FROM @xml.nodes('/Pr/id') x(i);
- In ASP.NET (Framework) encode the parameter value before concatenating it to the embedUrl:
using System.Web; // for HttpUtility var pIdXml = "<Pr><id>25</id><id>32</id></Pr>"; var start = startDate.ToString("yyyy-MM-dd"); // format counts! var end = endDate.ToString("yyyy-MM-dd"); var query = $"rp:P_IDS={HttpUtility.UrlEncode(pIdXml)}" + $"&rp:START_DATE={start}" + $"&rp:END_DATE={end}"; var embedUrlWithParams = $"{embedInfo.embedUrl}?{query}";Key points
- Use HttpUtility.UrlEncode (or Uri.EscapeDataString in .NET Core) on every parameter value that might contain reserved characters.
- Ensure the base embedUrl already ends without a query part; add ? once, then & for subsequent parameters.
- If the report only needs multiple numeric IDs you can skip XML entirely and pass them as a multi-value parameter:
Full Microsoft guidance: Paginated Reports – URL parameters
Try building the URL with the encoding applied and refresh the embedded viewer; you should now see the parameter values arriving intact. If parsing or report execution still fails, copy the final URL into a browser address bar to confirm the encoded XML string is complete.
✔️ If my message helped solve your issue, please mark it as Resolved!
👍 If it was helpful, consider giving it a Kudos!