Hello everyone,
I am working on my file explorer, which is supposed to access files and folders from two document libraries.
Users can access the SharePoint document libraries "DL_Permission" or "Dokumente2 "via the DropDown control "SelectionDirectory." The SP entries are loaded into a gallery.
In the Item property of the gallery, I am using the following code:
If(
!IsBlank(TextInput1_1.Text),
Search(
Filter(
Switch(
SelectionDirectory.Selected.Value, // Here
"Dokumente2", Dokumente2, // Here
"DL_Permission", DL_Permission // Here
),
'Folder path' = varFolderPathSelectionFiles &&
(
IsBlank(FilterValue.Text) ||
(varFilterItem_00_05 = "'File name with extension'" && Text(FilterValue.Text) in 'File name with extension') ||
(varFilterItem_00_05 = "Modified" && Text(FilterValue.Text) in Text(Modified)) ||
(varFilterItem_00_05 = "Modifiedby" && Text(FilterValue.Text) in 'Modified By'.DisplayName) ||
(varFilterItem_00_05 = "Created" && Text(FilterValue.Text) in Text(Created)) ||
(varFilterItem_00_05 = "Createdby" && Text(FilterValue.Text) in 'Created By'.DisplayName)
)
),
TextInput1_1.Text,
'File name with extension'
),
varFilterSortDirection_00_05 = 1,
Sort(
Filter(
Switch(
SelectionDirectory.Selected.Value, // Here
"Dokumente2", Dokumente2, // Here
"DL_Permission", DL_Permission // Here
),
'Folder path' = varFolderPathSelectionFiles &&
(
IsBlank(FilterValue.Text) ||
(varFilterItem_00_05 = "'File name with extension'" && Text(FilterValue.Text) in 'File name with extension') ||
(varFilterItem_00_05 = "Modified" && Text(FilterValue.Text) in Text(Modified)) ||
(varFilterItem_00_05 = "Modifiedby" && Text(FilterValue.Text) in 'Modified By'.DisplayName) ||
(varFilterItem_00_05 = "Created" && Text(FilterValue.Text) in Text(Created)) ||
(varFilterItem_00_05 = "Createdby" && Text(FilterValue.Text) in 'Created By'.DisplayName)
)
),
Switch(
varFilterItem_00_05,
"'File name with extension'", 'File name with extension',
"Modified", Modified,
"Modifiedby", 'Modified By'.DisplayName,
"Created", Created,
"Createdby", 'Created By'.DisplayName
),
SortOrder.Ascending
),
varFilterSortDirection_00_05 = 2,
Sort(
Filter(
Switch(
SelectionDirectory.Selected.Value, // Here
"Dokumente2", Dokumente2, // Here
"DL_Permission", DL_Permission // Here
),
'Folder path' = varFolderPathSelectionFiles &&
(
IsBlank(FilterValue.Text) ||
(varFilterItem_00_05 = "'File name with extension'" && Text(FilterValue.Text) in 'File name with extension') ||
(varFilterItem_00_05 = "Modified" && Text(FilterValue.Text) in Text(Modified)) ||
(varFilterItem_00_05 = "Modifiedby" && Text(FilterValue.Text) in 'Modified By'.DisplayName) ||
(varFilterItem_00_05 = "Created" && Text(FilterValue.Text) in Text(Created)) ||
(varFilterItem_00_05 = "Createdby" && Text(FilterValue.Text) in 'Created By'.DisplayName)
)
),
Switch(
varFilterItem_00_05,
"'File name with extension'", 'File name with extension',
"Modified", Modified,
"Modifiedby", 'Modified By'.DisplayName,
"Created", Created,
"Createdby", 'Created By'.DisplayName
),
SortOrder.Descending
),
Filter(
Switch(
SelectionDirectory.Selected.Value, // Here
"Dokumente2", Dokumente2, // Here
"DL_Permission", DL_Permission // Here
),
'Folder path' = varFolderPathSelectionFiles &&
(
IsBlank(FilterValue.Text) ||
(varFilterItem_00_05 = "'File name with extension'" && Text(FilterValue.Text) in 'File name with extension') ||
(varFilterItem_00_05 = "Modified" && Text(FilterValue.Text) in Text(Modified)) ||
(varFilterItem_00_05 = "Modifiedby" && Text(FilterValue.Text) in 'Modified By'.DisplayName) ||
(varFilterItem_00_05 = "Created" && Text(FilterValue.Text) in Text(Created)) ||
(varFilterItem_00_05 = "Createdby" && Text(FilterValue.Text) in 'Created By'.DisplayName)
)
)
)
Unfortunately, PowerApps reports an error with the Switch function in the context of the Filter function (Highlighted lines with "// Here") when 2 conditions "Dokumente2", Dokumente2, and "DL_Permission", DL_Permission are addressed.
With just one condition, the code works perfectly fine. After extensive research and despite asking in ChatGPT, I couldn't find the error.
What changes should I make in the code so that PowerApps accepts both conditions?
I would be grateful for any help!
Adam
varFolderPathSelectionFiles
Where are these variables set and what are they set to?
UpdateContext({varSelectedLibrary: If(SelectionDirectory.Selected.Value = "Dokumente2", Dokumente2, DL_Permission)})
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.