CANNOT make a foundset recalculate without loading a form

I am stuck trying to get my form with checkboxes immediately searchable after calculating an addition checkbox option.

If I add an Application.saveData() on every iteration of the loop that adds a value to my field, it works, however this is slow.

If I databaseManager.recalculate(foundset) after the loop is run, it does nothing. If I databaseManager.recalculate(foundset.field), it does nothing.

If I scroll (relatively slowly) through a table view of the data which shows my field, and then search for the value, it works perfectly, however I can’t expect the client to add a value, scroll to the end of the list and then search the value.

What am I doing wrong?

what is the dataprovider behind the checkbox? Is it a stored calc? Is it just 1 checkbox, or you have a value list of multiple choices on 1 form element?

Hi Scott.

Thanks for the reply.

It is a stored text field calculation which is a concatenation of related records separated by ‘’\n’, so there are multiple choices on one form element.

Hope all is excellent.

Bevil

I’d suggest avoiding stored calculations. A table event is almost always a better alternative.

Your core issue I would expect is that the data isn’t saved. Scrolling through the list is forcing your calculate to run, which then saves it, which is why searching it afterwards works. Same thing when you call a manual save in a loop.

I’d expect that if you look at the database after you do databaseManager.recalculate, that the value in the DB isn’t updated, which is why the search doesn’t work. This is essentially the issue with calcs. You have limited control over how often they run, and especially with a stored calc, when the value gets stored in the DB.

So, I’d remove the calc (but keep the column). Then trap whatever event would cause a change in the checkbox via a table event, then set the checkbox column manually. This could be slow, but only if one event is causing many rows to change, in which case you might look at accomplishing it differently.

Thanks Scott

I will see if I can change it…

Best

Bevil

It sounds as if you do a calculation of some kind just when you scroll through a table.
If that is the case, you maybe try to avoid such a calculation at all, because scrolling is mainly browsing data and should not need data operations at all.

If not maybe you explain in more detail which data has to change when you scroll, and why.