This vaccination app but want appear any vaccination for children more than 2 year

when enter birth data of child his age two years his vaccination appear
i dont want appear any vaccination for children more than 2 year /

This is not a solution but some comments about the things you need to consider to determine what you need..

Your method of storing data at present makes it difficult to determine those patients older than two years.

  • you store dates as childDates . Ordinarily this is fine except when you want to determine which date is earlier or later than a certain date. To solve this you can either store your dates as YYYY-MM-DD (2012-03-24) which can be 'sorted' as they are using a Text compare block or you can temporarily transform your d MMM, yyyy date into an instant and compare instances . To create an instant from a date, the date needs to be in the form specified by MM/dd/YYYY hh:mm:ss or MM/dd/YYYY or hh:mm and your data is not, so you have to convert your date format or use a different method to determine which data is older. Additionally you need to find the dates that are at least two years; you might need a Duration Clock Block. If Duration greater than 2 years, then that is the patient you want to appear perhaps in a List of patients older than two.

  • you have to be able to find your date information in your List of information. From what you shared, you only store data as a single Tag in a tinyDB. childData called Child Data , you might provide an example of what your patient data looks like. Dependent on how you structure your Lists, you should be able to determine which vaccinations are for children that are more than two years old. How? Since we don't know how the data is stored, no one can provide a specific recommendation.

1 Like

Here is a way to determine if a date in a List is a date less than two years (or more than two years) from today's date (Clock.Now). You might find it useful. The example cycles through a DOB list to find those dates less than two years away versus those that are greater than two years. What you need to do is more complicated and you will have to adapt the code to be compliant with your TinyDB.

This method only works if your date format in your app is specified by MM/dd/YYYY ; at present your dates are unfortunately incompatible. Either find a way to convert your date format to the specified format or a different way to determine Millis.

1 Like

this is the design

Shukrun @Elham_Ali for showing your Designer. The interface looks very nice. What is important is what your aia file and Block image looks like and an example of what your database contains.

Under your Child Data Tag in your TinyDB it seems you have a List that looks like you save:
Name Elham Ali
male false
female true
Day 6
Year 2021
Month Mar

You said

Where is his or her list of vaccinations? Or do you only want a List of children who are younger than 2 years old and need to be vaccinated?

What do you need help with?

  • Do you need help with your database design?
  • Do you need to know how to sort your database for all children younger than two year old today? To answer this, we need to know what is in your database. A method is shown in posts #2 and #3
  • Do you have a Tag for each child or all the children's information saved under Child Data Tag?

Perhaps write in Arabic instead of English? We would like to help.

1 Like

اود ان اشكرك على مساعدتك لي
مااريده هو اظهار التطعيمات للاطفال الذين اعمارهم من يوم حتى عامين فقط
والاطفال الاكبر من عامين تظهر ليهم رساله بانه لاتوجد تطعيمات لهذا السن ؟
لااعرف كيف استطيه عمل هذا الشرط
هل هناك مشكله فى طريقه تخزين البيانات فى قاعد البيانات
وهل هناك طريقه لحفظ بياناتهم حتى يستطيعوا اعادته بدلا من كتابه نفس البيانات كل مره

  • What I want is to show the vaccinations for children whose ages are from one day to two years only

  • And children older than two years show them a message that there are no vaccinations for this age?
    I do not know how I was able to do this condition Filter the ages of the children in your List. If DOB (date of birth) < two years ago then the child is under age 2 else child is over 2 years old

  • Is there a problem with the way data is stored in the database? Yes. There are several ways the way you store the data can be improved

  • Is there a way to save their data so that they can return it instead of typing the same data every time.
    Yes.

What you want to do is complicated. I will see if I can provide some code. Someone else might do it to.

@SteveJG I have compared the date you entered with the instantaneous date, but the notification does not appear
And I defined a variable to save the date from the three variables, but I think that there is a problem in implementing the conditions, I don’t know if what I wrote from the first is correct or not.

Sorry, I do not know. I suspect you have multiple issues. I cannot debug your issues by merely inspecting the fragments of code you posted.


The pattern you use to format a date is potentially a problem.


I do not believe it is possible to compare the DOB your provided in millis to Clock.AddYears.

I have some code I will share with you that works. You can keep experimenting until I post the code in a day or two.

1 Like

@Elham_Ali Here is an example of an app that does part of what you said you want to do

I hope it helps. The code you are working with might be able to work some day; the example works today.:slight_smile: Good luck with your Project.

1 Like

thanks for your effort and help i really appreciate that :smiley: :smiley: :handshake:

I tried and found a solution to it

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.