Hello @Palav Kothari ,
Thanks for the question and using MS Q&A platform.
As per your requirement, you can use a custom function module to take a query as Options and apply your own logic to retrieve the data.
Please see the below documentation to implement this custom function module.
Please let us know if you have any further questions.