Is it possible in Power App Gallery Items using Filter but also needing to count rows using ID from Items, but count rows from another child SharePoint list?
I am currently gathering Items for a Gallery using SortByColumns and Filter based on some drop downs or a search field as follows:
SortByColumns
(
Filter
(
[@'Vendors'],
SearchTextInput.Text in 'Vendor Name'
&& If(ddVendorStatus.SelectedText.Value = "All", 'Vendor Status'.Value = "Active" || 'Vendor Status'.Value = "Not Used Anymore" || 'Vendor Status'.Value = "Winding Down",
If(ddVendorStatus.SelectedText.Value = "Active", 'Vendor Status'.Value = "Active",
If(ddVendorStatus.SelectedText.Value = "Not Used Anymore", 'Vendor Status'.Value = "Not Used Anymore", 'Vendor Status'.Value = "Winding Down")))
&& If(ddVendorCountry.SelectedText.Value = "All", true, 'Vendor Country' = ddVendorCountry.SelectedText.Value)
),
"Title", SortOrder.Ascending
)
In a Text field in the gallery I am doing a CountRows that uses ThisItem.ID to count the rows in a child SharePoint List of the Vendors as follows:
CountRows(
Filter
(
[@'Vendor Surveys'],
'Consulting Vendor:ID'.Value = ThisItem.ID
)
)
Is there a way possible where I can load the value of the CountRows in the initial gallery Items method? So something like this - where I filter on ddSurveyCount either by All, Zero or > Zero?
SortByColumns
(
Filter
(
[@'Vendors'],
SearchTextInput.Text in 'Vendor Name'
&& If(ddVendorStatus.SelectedText.Value = "All", 'Vendor Status'.Value = "Active" || 'Vendor Status'.Value = "Not Used Anymore" || 'Vendor Status'.Value = "Winding Down",
If(ddVendorStatus.SelectedText.Value = "Active", 'Vendor Status'.Value = "Active",
If(ddVendorStatus.SelectedText.Value = "Not Used Anymore", 'Vendor Status'.Value = "Not Used Anymore", 'Vendor Status'.Value = "Winding Down")))
&& If(ddVendorCountry.SelectedText.Value = "All", true, 'Vendor Country' = ddVendorCountry.SelectedText.Value)
&& If(ddSurveyCount.SelectedText.Value = "All", true,
CountRows(Filter([@'Consulting Vendors Management Survey'],'Consulting Vendor:ID'.Value = ThisItem.ID)) > 0)
),
"Title", SortOrder.Ascending
)
I get a failure because the ThisItem.ID does not exist at this time in the Items method.
Is this even possible to this type of Lookup or CountRows from with the Items method? Or is this something I am going to have to create a Collection and then use that Collection in the Items Method?