Home > Forum > Data sources > Limiting the number of returned items

Limiting the number of returned items
0

How to limit the number of returned items for a data source in a filter? (to one item maximum)
Is only the DISTINCT or TOP option from T-SQL at the data source level left? Can this be done with some function at the filtering stage.

In reply to: Jacek Wojnar

Hi,
in my opinion using SQL data source (with TOP) would be easier in this situation.
Where do you want to use such filtering (what business case)?
Does the filtering depend on the current item or can you do it globally in the data source?

In the business rules you can indicate whether it should return one or many rows (screen)

In this case, I would prefer to write as little T-SQL syntax as possible and use the built-in mechanisms. I have an attribute of the "Data row" type. A BPS data source is connected to it (as in the screenshots) which is global (public), and for a given element in the process returns N values. On the form, I only need the last (newest value). So the rule in the filter field (Studio) limits my data source to these few rows, and ultimately I would like to limit it even more to one row.

MVP
In reply to: MANSOFT

Thanks for the tips. I thought I didn't know something about the application and it's my lack of knowledge that limits me.

I'll go back to good old T-SQL (although it was supposed to be LOW CODE app :) )

That's a question I've yet to answer for myself. Which kind of "code" is SQL. Most of the time it is "low code" for me but not "no code". :)

There's also the option to use the "Advanced search", where you could return the WFD_ID of the latest workflow instance.

Best regards,
Daniel