Forum Discussion
Why Am I Getting Two Different Results From One Constant Source?
- 8 years ago
- Anonymous8 years ago
Thanks again v-chuncz-msft. This seems to be working okay:
let GetData = () => if List.Contains(Table.ColumnNames(Web.Page(Web.Contents("https://webapps.MyDomain/path/req_search.cfm?page=AP")){1}[Data]), "Details") then
Table.RemoveColumns(Web.Page(Web.Contents("https://webapps.MyDomain/path/req_search.cfm?page=AP")){1}[Data],{"Details"}) else @GetData(), ShowData = GetData() in ShowData - Anonymous8 years ago
v-chuncz-msft, I went back and changed my query to use try-otherwise, with the recursive function structured as below, and it worked this way too. So I'm marking your original response as a solution. Thanks yet again for your help.
let GetData = () => try Table.RemoveColumns(Web.Page(Web.Contents("https://webapps.MyDomain/path/req_search.cfm?page=AP")){1}[Data],{"Details"}) otherwise @GetData(),
ShowData = GetData() in ShowData
Thanks v-chuncz-msft. I tried two different recursive functions. One uses try-otherwise and would theoretically keep refetching the table till it could find and and delete the column named Details, and the other uses if-then-else and would keep refetching the table till it could find the column named Details (if it's there, it's the right table). Both functions gave me the same error: Expression.Error: Evaluation resulted in a stack overflow and cannot continue.
When I substituted Kind for Details, both functions worked fine, because they fetched the second result table (from my original question's examples)...probably on their first attempt...and that second result table has a column named Kind.
Any other ideas?
My function attempts' code are:
let
Source = Web.Page(Web.Contents("https://MyDomain/path/req_search.cfm?page=AP")),
GetData = (DataSource) =>
let
DataSet = DataSource{1}[Data],
RemoveIt = try Table.RemoveColumns(DataSet,{"Details"}) otherwise @GetData(DataSource)
in
RemoveIt,
ShowData = GetData(Source)
in
ShowData...and...
let
Source = Web.Page(Web.Contents("https://MyDomain/path/req_search.cfm?page=AP")),
GetData = (DataSource) =>
let
DataSet = DataSource{1}[Data],
CheckForColumn = if List.Contains(Table.ColumnNames(DataSet), "Details") then
Table.RemoveColumns(DataSet,{"Details"}) else @GetData(DataSource)
in
CheckForColumn,
ShowData = GetData(Source)
in
ShowData
- v-chuncz-msft8 years agoCommunity Support
- Anonymous8 years agoNot applicable
Thanks again v-chuncz-msft. This seems to be working okay:
let GetData = () => if List.Contains(Table.ColumnNames(Web.Page(Web.Contents("https://webapps.MyDomain/path/req_search.cfm?page=AP")){1}[Data]), "Details") then
Table.RemoveColumns(Web.Page(Web.Contents("https://webapps.MyDomain/path/req_search.cfm?page=AP")){1}[Data],{"Details"}) else @GetData(), ShowData = GetData() in ShowData - Anonymous8 years agoNot applicable
v-chuncz-msft, I went back and changed my query to use try-otherwise, with the recursive function structured as below, and it worked this way too. So I'm marking your original response as a solution. Thanks yet again for your help.
let GetData = () => try Table.RemoveColumns(Web.Page(Web.Contents("https://webapps.MyDomain/path/req_search.cfm?page=AP")){1}[Data],{"Details"}) otherwise @GetData(),
ShowData = GetData() in ShowData