Put a condition when scanning QR code

Hello, comunity. I m john. I developed an application that you helped me develop. In this application I put a button to scan which calls the Barecode Scanner to scan a QR code and send the information of the QR code in the sheet. I would then like a condition that the same QR code cannot be scanned twice on the same day. It therefore takes an interval of 24 hours for the same QR code to be scanned. If the same QR code is scanned in less than 24 hours, the sending of the QR code information in the file will be refused. With a notification like: this QR code will only be scanned after 24 hours. Can you help me please ?

My aia this :

abcd.aia (3.4 MB)

Use a clock to check the date.
When you save a information, save the date when that information was saved too.
Then, when the app scan, check in the database if that information was saved in the same date. if true, show an alert to ther user that it was already scanned today. Otherwise, save it in database.

PS: if the information can be scanned one time each day is one thing. If it is one time on each 24 hours is another thing.
If now it is 23h46 pm and i scan the information, after 15 minutes will be another day so the user will be able to scan the information and save it in the database again. But if the rule is “24 hours at least” only in the end of the next day it will be possible.
Think what case is the best for you.

after scan1, store the result in tinydb and the current time in millis

second time after scan , just check the result with tinydb, if is same, compare the current millis with saved millis, if the difference is greater than 86,400,000 then proceed. else pop us alert

If the result is not same present result and prev result just proceed

1 Like

Thank you very much for your answer. You are exactly right. Only that I ran into a problem. Can you if possible help me to do it in my blocks? I find it difficult to do this because my knowledge in this is a bit limited. If it is possible can you help me to do it please :pray::pray::pray:

Thanks very much. your idea is great. I will use it for another application that I am trying to create with Kodular. I have nevertheless in my app script introduced the time variable, and this is where I will compare the days. Thank you very much for your answer.

1 Like

Show what you tried and we can help you to get the answer.

1 Like