Please help me... I have some problem with global variable

Hello guys
Please check given blocks
I have some problem with Global variable number
When I click on done button in listview numbers count regularly like 1 2 3
And when I close app and again tried to click on done button numbers count Again start from 1 and 2

How to stop this nonsense

:point_right: i want numbar never repeat again & again

Ok and what’s the problem?

3 Likes

What’s the problem clear it

3 Likes

Use the Tiny DB Component and save the the last number as a value to a tag named previous number or anything and get the value via Tiny DB

3 Likes

If you store value in variable, Then they will be set to default every time you close app you must use tinydb to store values and call them

2 Likes

Please check I describe now

U must use tinyDB component to store those value like 1,2,3,4 etc if you use global variable then when you close app it will delete all values from variable

All of the answers are correct, so let me summarize.

  1. Global variables are volatile, meaning when the screen or application closes the contents are lost. They are not sticky.

  2. To have a variable be sticky across screens, or across application usage, you need to store that content/state somewhere. Examples include TinyDB, Files, firebase, etc.

Setup a procedure to

a) Write to the place holder (like TinyDB)
b) Read from the place holder
c) Error check if there is a problem.

Beware, TinyDB data is destroyed if someone uninstalls the application. You will need to store in another maner if you want the data to be sticky across devices, or installs.

2 Likes

Please help me with set the blocks for me

Bro try it yourself first and ask if you face any problems, this will help you in learning more
Kodular is all about EXPLORING :wink:

You have to decide how you want things stored. As @Deepanshu_Arya said you gotta try things out. there are so many block examples and snippets around with a little bit of work you can find and do it.

1 Like

How do you want the time to be taken? From online or from user’s device?

See this video it will help you get a basic knowledge about this

Ty all my dear friends…

If u got your problem solved then tick the best answered as solution as it will help other on the same problem

I don’t know about coding and don’t know how to solve this problem
I trying to solve but I didn’t get my solution

Simply U can use this coding, And need one extension…com.LukeGackle.countdown.aix (11.2 KB)

this is the block If u need to coutdown upto a date u want. example start date is current running date or 07/31/2019 12:00:00 and end date is 08/10/2019 12:00:00 the this coding will help to what to do after time ends. if anyone got more simple blocks than this plz tell fast…

see below post

see the solution below :innocent: