Hello,
I have a related foundset and maybe perform a find() in it. Is there a way to figure out if that foundset is just plain related or further filtered?
Currently I see no way…
Thanks
Patrick
Hello,
I have a related foundset and maybe perform a find() in it. Is there a way to figure out if that foundset is just plain related or further filtered?
Currently I see no way…
Thanks
Patrick
Patrick,
There is a method on foundset: isInFind().
Btw, when a foundset is in find mode, calling find() on it will do nothing and return true.
Rob
Rob,
I was aware of that, but I don’t think it does what I need.
I have a relation e.g. customer_to_orders. I allow the user to perform a find in that (e.g. filter by product). In my UI I remember what was filtered for what customer ID using form variables.
Now I think that Servoy “caches” these foundsets. So if the user selects customer A, filters the relation, goes to customer B and back to customer A, the relation for customer A will still be filtered. But: at some point in time I guess, these foundsets are no longer cached but reloaded. Then my filter is gone, but my UI still thinks it’s filtered.
So my question is: can I find out not if a foundset IS in find, but has been filtered or not. I want to know if the related foundset is the “original” related foundset or further filtered by a find()/search().
You understand what I mean?
Something like: foundset.isFiltered(). This could also be useful for a non-related foundset. A way to find out if a find() has been performed or not.
Patrick,
You are right, Servoy keeps a soft cache of related foundset that are reused every time you request a related foundset for the same base record.
If you do a find/search on a related foundset it will change the state of that foundset and anywhere else you show/request that foundset later you may get the filtered one or a fresh one depending on whether the foundset was garbage collected.
To prevent this scenario, do not search in related foundsets, only on copies (customer_to_orders.duplicateFoundSet())
Rob
Hi, we are so unhappy with this default servoy behaviour…
It leads to very hard to find bugs…
How can we get all developers in our team to never use find/search in related foundsets or to always use foundset.loadAllRecords() when using a related foundset
Regards,
patrick:
Something like: foundset.isFiltered(). This could also be useful for a non-related foundset. A way to find out if a find() has been performed or not.
How about using databaseManager.getSQLParameters(foundset, boolean includeFilters) ?
If you get parameters in return, then it is a related foundset.
Otherwise it isn’t.
This will not help you in all cases, but perhaps in some of them it will.