I am currently doing a personal project for school and I have decided to create a finance app using MIT App Inventor 2. I am almost done with the app but one of the things that I have problems implementing into the app is ranking the categories the user is spending on the most based on their inputs so that the app can show a message to the user on suggestions on how they improve their spending habits. I planned out how I could achieve this and pieced together a rough plan of how it would work.
The app calculates the budget and actual amount of the user’s expenses for each category, it will make a list of the budget and actual amounts for each category.
The app will then find the differences between the actual amount and budget amount for each category.
The app will then rank the list from the smallest to the largest differences in budget and actual for each category.
The app will then take that ordered list of categories and insert it into a temporary database.
The app will then turn the differences in each category that it represents (Home Expenses, Utilities, Food, etc).
The app will then display the text from the database into the notifier that will pop up.
However, so far I have only coded until number/step 4 but some for some reason, the app constantly gives me the same error message every time I tested it after trying countless times. It says "The operation length of list cannot accept the arguments: , [nothing]". I would really appreciate it if someone could kindly take some time to correct my blocks ASAP.
You list items is either empty or a broken list. Ensure that all your textboxes are NOT empty, if you have no value for them, set as 0, do not leave them blank.
None of them are empty. In fact, I have actually previously made a system that filled in any empty slots with a 0 based on past experiences. How can I fix a broken list? Thanks for the quick reply though!
When your app initialises, it uses the values in each textbox at initialisation to create the list, so they are probably all empty. You will need to set the values in each textbox and then generate the list....
Oh, the function only activates when the user clicks the button. I have provided the entire project below so we don't have to keep going back and forth on the things that I have already included in the project. I may have also unknowingly messed up the code by activating other things at the same time. Here's the aia project (the "Monthly" screen is where the error is, sorry for the mess): The_Finance_Budgeter.aia (6.1 MB)
It doesn't have to, that is just my example. The important thing is to set the list at the correct time, when the textboxes contain all the values you want to use, not on initialisation when all the textboxes are empty.
Ah, yes, didn't look over far enough. You do not appear to be generating the list with values in textboxes as I advised. Look at my blocks again, and build your list only after you have added values to the textboxes. As your blocks stand, your items list is full of empty values.