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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
melanieArugula
Frequent Visitor

Expression.Error: We cannot apply field access to the type Text.

I'm trying to get a list of solutions to vulnerabilities. The API link uses the vulnerability ID which is a combination of text and numbers. The error is in the GetSolution function where I'm using the text from the vulnerability ID column. 

 

let

Vulnerabilities = () =>

let

Source1 = Json.Document(Web.Contents("https://[link]/api/")),
page = Source1[page],
count = Number.ToText (page[totalResources]),
Source2 = Json.Document(Web.Contents("https://[link]/api/?page=0&size=" & count & "&sort=id,asc")),
Resources = Source2[resources],
Table = Table.FromList(Resources, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
Expand = Table.ExpandRecordColumn(Table, "Column1", {"id"}, {"id"}),
txt = Table.TransformColumnTypes(Expand,{{"id", type text}})

 

in
txt,


GetSolution = (column) =>

let

Source = Json.Document(Web.Contents("https://[link]/api/" & Text.From(column) & "/solutions")),
Resources = Source[resources],
Resources1 = Resources{0},
Summary = Resources1[summary]

in
Summary,

 

VulnerabilitiesList = Vulnerabilities(),
Solutions = Table.AddColumn (VulnerabilitiesList, "Solution", each GetSolution([id]))

 

in
Solutions

1 ACCEPTED SOLUTION

This helped a lot, but I don't know exactly why, maybe because I was able to call the column from the table I was using. As I'm writing this I realize I could really condense the link situation, but in any case, I'm glad it's working. Thanks for your help! 

 

let
Source1 = Json.Document(Web.Contents("https://[link]/api/")),
page = Source1[page],
count = Number.ToText (page[totalResources]),
Source2 = Json.Document(Web.Contents("https://[link]/api/?page=0&size=" & count & "&sort=id,asc")),
Resources = Source2[resources],
Table = Table.FromList(Resources, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
Expand = Table.ExpandRecordColumn(Table, "Column1", {"id"}, {"id"}),
txt = Table.TransformColumnTypes(Expand,{{"id", type text}}),
Solution = Table.AddColumn(txt, "Solution", each Json.Document(Web.Contents("https://[link]/api/" & [id] & "/solutions"))),
#"Expanded Solution" = Table.ExpandRecordColumn(Solution, "Solution", {"resources"}, {"Solution.resources"}),
#"Expanded Solution.resources" = Table.ExpandListColumn(#"Expanded Solution", "Solution.resources")
in
#"Expanded Solution.resources"

View solution in original post

2 REPLIES 2
lbendlin
Super User
Super User

Since you are pulling a solution for each vulnerability why not integrate the second web call into the Vulnerabilities function? It would go in after the Expand line.

This helped a lot, but I don't know exactly why, maybe because I was able to call the column from the table I was using. As I'm writing this I realize I could really condense the link situation, but in any case, I'm glad it's working. Thanks for your help! 

 

let
Source1 = Json.Document(Web.Contents("https://[link]/api/")),
page = Source1[page],
count = Number.ToText (page[totalResources]),
Source2 = Json.Document(Web.Contents("https://[link]/api/?page=0&size=" & count & "&sort=id,asc")),
Resources = Source2[resources],
Table = Table.FromList(Resources, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
Expand = Table.ExpandRecordColumn(Table, "Column1", {"id"}, {"id"}),
txt = Table.TransformColumnTypes(Expand,{{"id", type text}}),
Solution = Table.AddColumn(txt, "Solution", each Json.Document(Web.Contents("https://[link]/api/" & [id] & "/solutions"))),
#"Expanded Solution" = Table.ExpandRecordColumn(Solution, "Solution", {"resources"}, {"Solution.resources"}),
#"Expanded Solution.resources" = Table.ExpandListColumn(#"Expanded Solution", "Solution.resources")
in
#"Expanded Solution.resources"

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors