CommCare supply setup, app crashed

Hi,

I have just developed an application that will be able to manage medication at the health centers. We therefore have more than 500 medication to manage. We added these drugs in commcare supply in the product setup. The problem is that if we want to select some medication from a lookup table and then display them one by one in a repeat group, the application crashed because of this number of medication. (If the number of active medication is less than 50, it works well). Can you help us please?

Thanks!

I remember running into performance issues when using this combination of features.

depending on the elements you have in your repeat, if they are performing any kind of reading from the database like from casedb or locations or whatever, it will slow you down unless you limit the number of times these calculations fire. they sometimes fire when you change any value in your form. can be really confusing. so, if you have a calculation in your repeat, each time you select from your lookup table, it will redraw the repeat for the first element, then the first and second, then the first, second, and third, and so on. so, when you've added 50 elements, if this is the dynamic taking place, you are making 50! (that's 50 FACTORIAL!!!!) iterations for each question in your repeat. It seems like it shouldn't be the case, but I think I understand why it works that way.

putting calculations in the default value instead of the calculate condition might help some.

using the "depend" function will help some.
CommCare Functions - CommCare Public - CommCare Public

Adding an "if" statement that checks if a specific question is answered, returning a blank when it isn't, and your calculation if it is, will help tremendously. so, if(questionA = "", 0, calculation). make sure that questionA is all the way at the end of the form. except, you should know that it will still lag a little bit when that question is answered.

it's better than being unusable though.