Number Increment and store

Here i want to store sr no when button upload is clicked.
But when i close the app completely then the no resets to 1 and so on, pls help.

also m facing error the operation + cannot accept argument: , [""], [1]

Thank you

You are incrementing "current_sr" but storing "sr_no", is that ok?

If "sr" is not there, then you get an empty string...

which is later used here, like a number:

Place in valueIfTagNotThere a number 0, like default value.

stilll the same error

Have you changed it in all the GetValue blocks where you are expecting a number?

Even, I can see in a StoreBlock you are storing a 0, like a string ???

If you are storing numbers, store numbers and recover numbers.

And check this...I don't know if you want ton increase one variable and store other different but, this has not sense...you are changing "current_sr" variable three times in a row...and finally, storing other variable:

1 Like

your_variable = value stored in tinyDB.
your variable = your_variable+1.
store your_variable in tinyDB

1 Like

Looks like you are developing on Niotron/Kodular, please ask your questions on the respective community.

Closing

1 Like

so when the app is deleted and installed again then it starts from 1 again.

Please provide me with a code using cloud DB for the same.

Thank You

FAQ Section: CloudDB - Frequently Asked Questions - MIT App Inventor Community

could u pls provide a updated code for above

coz i have confusion about when to use gotValue and dataChanged for the use i want

It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.

To get an image of your blocks, right click in the Blocks Editor and select "Download Blocks as Image". You might want to use an image editor to crop etc. if required. Then post it here in the community.

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

Screenshot 2024-04-30 223611

the main query is same as above in earlier posts

When you call to GetValue block, you will get the response in GotValue event block. When you modified your cloudDB data, then you will get the response in DataChanged event block.

Usually you use an online database for several users... so if one user reinstalls the app, you want to restart from 1 for all users?

Taifun

so which block should i use to get the output which i need

not actually ,
i just want the sr no increase when the button is clicked which should be in a sequence, for what so ever reason.

Your blocks are right. When you call to GetValue, then the response is received in GotValue block. Then you are storing the new value (+1) in the same tag.

When "Store" finishes, then you can get the response in DataChanged block.

EDIT: you are incrementing +1 the variable srNo, BUT storing the same value in the same tag....it would be valueToStore = srNo

and you can remove this:
image

In this case I do not understand your requirements

Taifun

Ok Thank you I will try and check and revert to you