Search code examples
argumentsandroid-checkboxapp-inventortinydb

The operation TimerInterval cannot accept the arguments: [(1800)] in App Inventor 2


I'm stuck on an error in my App Inventor 2 application. I' m using three checkboxes, so the user to pass values to a timer interval in a clock component.

The values are stored in a variable as a list of three values of miliseconds (e.g. 1600, 1800, 2000). I check in code when and which checkbox is checked and then pass it over to a TinyDB database as a tag.

Problem is that, in Do it and on the device running the app, I get the following error as title suggests.

Here is the coding blocks I've used so far:

enter image description here

Does anyone be kind enough to direct me to how solving this error? Is it possible to pass values to a clock component through this logic. I've used a listPicker with success sometime ago, but I need it done with a checkBoxes layout. Thank you all in advance for your answers.

[Edit1] To overcome this error and before @Taifun's remarks and suggestions, I followed the variable path, to pass values in the timer interval field. Do not now if it is very efficient but it is working for now. Here is the coding blocks:

enter image description here


Solution

  • Bracket pairs like this () represent a list.

    The operation TimerInterval cannot accept the arguments: [(1800)]

    This is, what the error message is trying to tell you: You are trying to assign a list, which has the item 1800 inside, to the TimerInterval property of a clock component.

    You should assign the value directly instead.

    enter image description here

    Also you should think about the default value: which value should be used, if the user did not store anything in TinyDB... You are currently using an empty string in the valueIfTagNotThere socket... This does not really make sense... A better value would be for example 1000 ... same for the else part in your if-then-else statement...