I have a getItems
function that accepts a filter, but I need to know how to pass in two different filters so that I can retrieve items filtered by both Age and First Name.
Here is the definition of the function:
public getItems(list: string, id: string, filters?: string[]): Promise<any[]> {
let filterStr: string = 'startswith(ContentTypeId,\''+ id +'\')';
return new Promise((resolve, reject) => {
let query:any = pnp.sp.web.lists.getById(list).items;
if(filters)
filters.map((rowFilter: string) => { filterStr += ' and '+ rowFilter; });
console.log(filters)
query.filter(filterStr).get().then(Items => {
resolve(Items);
}).catch(e => {
reject(e);
});
});
}`
list
,id
, orfilters
? If you can include examples of your parameters in your question we can see where the problem may be. – willman Feb 26 '20 at 13:55