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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors