Unable to fetch app definition. Ran out of resources evaluating: IF

Unable to fetch app definition. Ran out of resources evaluating: IF

Did that happen to anyone else? What the error is about, it doesn’t even indicate it

Sounds like you have an IF() expression somewhere in your app that has a quite big formula that the app is not able to handle. Could that be the reason?

2 Likes

HI @AleksiAlkio , Actually it may be, but I’ve had the app running with low logs for a long time and now I’m getting this error. The problem is that it doesn’t give me “the equation” that I should correct. It’s obvious (since I only see one IF) that this must be a large expression. But it’s very awkward inside the editor not being able to tell what the expression is (since it doesn’t point to it)
I have made some decisions, I have consulted chatgpt and it told me that probably, in conjunction with all the formulas, the app is probably consuming too many resources. So I decided to go back deleting some virtual columns to be able to have visibility in the application while editing (no errors) and they have been corrected momentarily, I have lost days of work but not my app. I leave you a solution in case it ever happens to you and thanks for writing.

What the chat suggests is literally “polishing and simplifying” the app. There are ways to reach the same result that, when we develop, we discover. What he suggests to me is that I look for the easiest way to face it. I am now evaluating the importance of the information that I require, if I will do all the calculations in the app or also include the possibility of doing them outside (in a google sheet spreadsheet, for example). In addition, an option that occurs to me at this moment while I am writing to you is to create virtual columns of repetitive expressions; I will explain better:

If I have to do a similar validation on several fields, with a SELECT(), in that case it is convenient to make a virtual column that is calculated once and target that virtual column in the validation and not apply the same formula in all the validations or well wherever you need it. I imagine that this will lighten the app a lot because the calculation is done only once. I am in the process of fixing the problem. I warn you anything but this is the way.

Greetings @AleksiAlkio

When creating apps, it’s always the question where the balance is. Should I use virtual column or just use another formula where you need it. The quickest apps that I have seen or worked with, they normally have as little calcualtions with the virtual column as possibe because they are always calculated when you sync.

Quite often people are saying that they need inline views, but when discussing futher, it doesn’t matter if they click one button (linktofilteredview) or scroll down to see that view. The time from user perspective is the same.

The reason why this happens now, could be that AppSheet has changed something very little and your formula has been in the “limit”. Just guessing though..

3 Likes

Yes, completely agree! It would be great if appsheet develops an optional protocol for working with your apps, explaining this and many other issues.

I’ll tell you a little while I’m here, I have a table called inputs (which are the things that are bought to produce) and another table called elaborations (which are the things that are produced).
The elaborations table has a child table called “Component Elaborations”. These components can be inputs or other elaborations but not the elaboration in question (this is configured to avoid circular calculations).

However, the inputs have costs and the preparations have components and these components have costs. If they are inputs, it is the sum of [Related Crafting Components][Cost], without further problems. The problem appears when I want to add elaborations as components. Its cost must be calculated by going back to the parent table to take the cost of some elaboration, since in this case the cost is taken from the elaborations (clearly all those that are not this RowID, but that appsheet does not take it into account apparently). I inevitably need them to be virtual columns because the value that I need to calculate must be updated in real time every time the price of the input varies, since in Argentina there is an irreversible process of inflation. Anyway, I’m going to try to get the calculation out of appsheet and put it in google sheet, either way, the column value should respond to a formula that I don’t need to see in the form. Until the data is synchronized, it is possible that in google sheet it has been calculated as well. I’m going to try that solution as a last resort.

The other option that occurs to me but that I don’t handle well, is to create a bot to update the real columns of a table every time there is a change. Thinking very in the air.

I would probably use Event action with “Execute an action on a set of rows”. If you calculate with sheet formula, it makes the calculation every time you sync and the sync needs to wait those calculations are all done.

1 Like

Ok, I’ll try that way “Execute an action on a set of rows” let’s see what comes out. ChatGPT tells me that this is probably a case of infinite loop. So I’m going to have to do this with actual columns. I find it a good practice to “Execute an action on a set of rows”. I’ll try and give you the solution here as soon as I get it @AleksiAlkio