@Anonymous
Very possible. It is all up to the inferences that PowerApps makes with the datasources.
It will "try" to match schemas and provide something, but if it cannot, then it will not have what you want. If you "happen" to get it to guess what you want, then there is always a very good chance that it will fail in play mode.
Take for example a gallery with an Items property of:
If(Checkbox2.Value,
Table({Item: "X"}),
Table({Value: 1})
)
What would the resulting schema be? Well, if you look at what PowerApps guesses, then it is actually nothing.
And, if you place a control in the gallery and refer to ThisItem. there will be nothing to choose from because it could not infer a schema.
NOW...to really appreciate this, one would think "if I re-establish the schema to be common between the two, then it will work!" - well...sort of!
So, you change the formula to:
If(Checkbox2.Value,
ForAll(Table({Item: "X"}), {MyCol: Item}),
ForAll(Table({Value: 1}), {MyCol: Value})
)
So now, each condition will return a table with a MyCol column.
HOWEVER, PowerApps likes to be strict! It will look at that and still not infer a schema. It will still not consider that the result is a table with a MyCol column record. This is because in the first, the columns are Text. And in the Second, the columns are Numeric!!
But, changing the formula to:
If(Checkbox2.Value,
ForAll(Table({Item: "X"}), {MyCol: Item}),
ForAll(Table({Value: 1}), {MyCol: Text(Value)})
)
This will have a common schema and PowerApps will know that the result is a table with a record with MyCol.
So, you need to apply this logic with your multiple datasources.
With({Reports:
If(NoLinksOnly,
ForAll(
SortByColumns(
Search(
Filter(REPORT_DETAIL_MISSING_OBJECT_LINKS, Report_EDW_Project_Name in ComboBox_EDWProject.SelectedItems),
TextInput_ReportSearch.Text, "Report_Name"
),
"Report_EDW_Project_Name", Ascending,
"Report_Name", Ascending
),
{ID: ID,
Report_Name: Report_Name,
Report_EDW_Project_Name: Report_EDW_Project_Name
}
),
ForAll(
SortByColumns(
Search(
Filter(REPORT_DETAIL, Report_EDW_Project_Name in ComboBox_EDWProject.SelectedItems),
TextInput_ReportSearch.Text, "Report_Name"
),
"Report_EDW_Project_Name", Ascending,
"Report_Name", Ascending
),
{ID: ID,
Report_Name: Report_Name,
Report_EDW_Project_Name: Report_EDW_Project_Name
}
)
)
},
ForAll(
Sequence(CountRows(Reports)),
Patch(Index(Reports, Value), {RowNo: Value})
)
)
Technically, this can all be simplified as well, but I left it a bit "lengthy" to demonstrate each part for you.
The above will provide a common schema for the gallery.