Join the Team Forms community

Updated 5 days ago

Filtering options list

At a glance

A community member is trying to filter out options from a SharePoint data component within a data grid component. They have an Excel file with numbers from 1 to 30 displayed in the SharePoint data component, and users can select multiple values. The community member wants to ensure that the selected values (e.g., 2, 4, and 6) are not displayed in the second row of the data grid component. Another community member provided a solution using the "Filter Query" setting in the SharePoint data component to filter out the records that have already been selected.

Hi everyone,

I am trying to filter out the options from one SharePoint data component which is inside the data grid component. In my SharePoint data component i have used an excel file where i am displaying numbers lets say from 1 to 30. Moreover, the user can have multiple values in it. For example, the user selected 2, 4 and 6 numbers from first row of data grid component from the SharePoint data component now what i want to achieve is that in the second row of data grid component in the SharePoint data component those three numbers (2, 4, 6) should not be displayed. How do i achieve this any suggestions would be useful.

Many thanks!

Marked as solution

Hi @Anonymous

To achieve what you are describing you will need to use the "Filter Query" setting in your SharePoint data component to filter out records which have already been selected in your data-grid. You can use a filter like the one below, however you will need to modify it to fit your specific form.


JavaScript
let selectedValues = []

// Loop through the data-grid and track which items have already been selected 
data.dataGridName.forEach(r =>{
    const selections = r.spSelect.map(s => s.NumberColumn)
    selectedValues.push(...selections)
})

show = !selectedValues.includes(item.NumberColumn)
View full solution
E
A
1 comment·1 reply

Hi @Anonymous

To achieve what you are describing you will need to use the "Filter Query" setting in your SharePoint data component to filter out records which have already been selected in your data-grid. You can use a filter like the one below, however you will need to modify it to fit your specific form.


JavaScript
let selectedValues = []

// Loop through the data-grid and track which items have already been selected 
data.dataGridName.forEach(r =>{
    const selections = r.spSelect.map(s => s.NumberColumn)
    selectedValues.push(...selections)
})

show = !selectedValues.includes(item.NumberColumn)

Hi Erin, thanks a mill it worked perfectly. 😃