Skip to Content
3
Mar 19, 2020 at 09:55 PM

CAP CDS NodeJS Use only part of filter in custom logic

1562 Views

Hi Experts,

I have a CAP project and I would like to get data from two tables and do some stuff with it in the custom logic handler with NodeJS. If filters are passed to the entity, I only want to use all filters on one table and a specific filter for the other table. Does CAP come with a NodeJS API for this? Any best practice on how to do this? Now I did this quick and dirty like this:

let idx = req.query.SELECT.where.findIndex((filter)=>filter && filter.ref && filter.ref.find((field)=>field==="Prop"))

let whereProp = [];
whereProp.push(req.query.SELECT.where[idx]);
whereProp.push(req.query.SELECT.where[idx+1]);
whereProp.push(req.query.SELECT.where[idx+2]);

Thank you in advance!

Kr, Wouter