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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
cmeu
Advocate III
Advocate III

Web.Page() provides no results in service, works in desktop

Hello, I am trying to use Web.Page() to perform regular expression pattern matching. It is successful in the desktop environment, but not providing results when published to the service. I am not a gateway or capacity admin, and am on premium per capacity. This dataset requires no gateway, and I am unable to select one. 

This M-lang works in desktop, but fails in service. What is wrong here?

 

let
    fx_re = (text as text, pattern as text) as list => Web.Page("<script>document.write(new RegExp('"& pattern &"').exec('"& text &"'))</script>")[Data]{0}[Children]{0}[Children]{1}[Text],
    
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("TYw7DsIwEAWv8mIakCIk/tDScIF0UQoTNsTC9lpeB5TbcBZOhqFASK+Y4s3UtVosV+vNdrc/qFKdmC9wHL3x1wJVbwR5HUdMKtLuaAdCyuB0IikRLGkhRJLA/oLESB+lZX9naEGIuk2mpXlOaX/DyEOB6Tf7MNbinGs9gb0df18EloQussMgf+Ls9VRN8wY=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [id = _t, body.content = _t]),
    ct = Table.TransformColumnTypes(Source,{{"id", Int64.Type}, {"body.content", type text}}),
    #"do RegEx_extract" = Table.AddColumn(Table.Buffer(ct), "hashtag", each fx_re([body.content], "#[^\\s\\d]+[\\d\\w]+")),
    #"Removed Errors" = Table.RemoveRowsWithErrors(#"do RegEx_extract", {"hashtag"}),
    #"Expanded hashtag" = Table.ExpandListColumn(#"Removed Errors", "hashtag"),
    #"Filtered Rows" = Table.SelectRows(#"Expanded hashtag", each ([hashtag] <> "null") and not Text.StartsWith([hashtag], "#WO0") and Text.Length(Text.Trim([hashtag]))>3),
    #"Renamed Columns" = Table.RenameColumns(#"Filtered Rows",{{"id", "ht_conversation_id"}}),
    #"Changed Type" = Table.TransformColumnTypes(#"Renamed Columns",{{"hashtag", type text}})
in
    #"Changed Type"

 

 

3 REPLIES 3
cmeu
Advocate III
Advocate III

Point of clarification - when I say it 'fails,' that is: It returns an empty dataset. There is no error and refresh succeeds normally.

Hi @cmeu 

 

What you might need is to put in a table that actually can be refreshed. Without something to refresh it wont actually do any updates.





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

Proud to be a Super User!







Power BI Blog

hey @GilbertQ - The embedded source table included above is meant to be representative of something else, for performing tests in relation to this thread. The actual source data is coming from a set of json files hosted in the same tenant on sharepoint.

Switching between the included table from binary and the sharepoint folder does not change the outcome

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors