WU: Fetching data vs performing a search

In terms of WU, how does ‘Do a Search For’ compare with ‘Current User’s _____’?

So for example, if I have an invoices page and a user has potentially hundreds of invoices, does it make much of a difference if, when an invoice is generated and gets attached to the user, to display invoices using a ‘current user’s invoices’ vs ‘do a search for invoices, with current user being the search criteria’?

What i do, i put such thing on his entity and link then one way, like a Invoice data type and inside it ref_user whould be the user for which it was generated.

if you attach all the invoice to user, evey time use open a page, bubble will download them too, which make the app loading slow.

but if you put them inside there own entity, you load them only when you want to show them.

1 Like

Do NOT do this…the list field on the user data type that you would be adding potentially hundreds of invoices to will become a problem and also would be generally slower to load all invoices if using ‘current users list of invoices’ because of the large number of invoices potentially attached to the user…General rule of thumb is that if a list field will have 20 or more items on it, it will be slower to load than if you simply did a search for thing and constrain by a field that is the user (can be the built in created by if the user will be the one creating the invoice).

Also, if you put on Privacy Rules for invoice that only the creator (ie: built in field created by) is current user, that acts as a ‘pre-filter’ (something I just learned recently) which will be done server side and speed up the fetch and return of data.

So, on a page to show the user their invoices, do a search for Invoices and constrain by the User - should not have a significant impact difference on WUs since the amount of WUs consumed by search relies a lot on the amount of data returned. So, there likely is no real difference in terms of WUs consumed, however, maybe the ‘current users invoice list’ is more data returned because it also references the user data type, so all of that data would potentially be returned as well.

The only real difference for WU consumption for searches is between a search and a fetch of a single item thing, which I personally still don’t even know how we are doing a fetch of a single item thing except for when that is done via a page content type (ie: current pages thing)