Current Day vs Selected Day

Yes you can.

I can demonstrate it inside a loop. Will create one later tonight or tomorrow morning.

1 Like

Thank you very much, have a good evening @muneer :slight_smile: .

1 Like

I created a test scenario to make sure the function works.

This sets the list and populate it with sample data

The sample data is shown in a list.

This is the routine that will remove the status messages if available.
image

Sample run
image

Processed list
image

2 Likes

Thanks for the sample block @muneer . I tried implementing this and ran into a few issues. The function does not seem to remove the status as it keeps duplicating it when the screen is opened. I added a wait block to confirm this.

Remove status function:

Calling function:

Result when opening the screen more than once:

Any idea why this could be occurring? Thanks!

1 Like

@muneer

Edit

I have found that the functions works when I set j to the function rather than in list app variable timetable insert as app variable i as remove status with assignment: j

image

1 Like

Do you mean to say that the problem with the in list ... set ... block?

1 Like

Yes, it is not removing the status. The modification I outlined above works fine though but I am not sure why list block would not be working.

1 Like

So you can safely mark this post as solved. Anyway, the subject of the post is the comparison of dates which was solved already.

1 Like

Thank you so much @muneer for taking the time to help me solve my queries. Your knowledge and expertise you have shared with me has taught me a lot. This was quite a challenging topic but Thunkable has such a helpful and kind community that takes the time to help with anything.

2 Likes

Thank you for the nice complement.
I have retained a copy of your project that you previously shared as I want to go back to it and instead of using text items in the list, I have the idea to change it to list of objects which would get rid of many substring operations.

This would be my little gift to you.

1 Like

Thank you so much! Please feel free to look through the project and share any feedback or suggestions with me, here is the latest link:

https://x.thunkable.com/copy/65a6b3f99bbbe00afec26a323ba082d0

@muneer Hi Muneer,

I completed my application a couple of month ago and have not really looked at since. I recently decided to test it again to add some improvements and all the date functions / algorithms you helped make in this thread seem to be broken. The status does not seem to be working; no matter what date you select in the assignment, the status will be ‘due today’. I checked and this seems to be because the assignment date and the current always are the same for some reason. I have spent a while trying to fix this to no avail, so a fresh pair of eyes on this problem would be much appreciated.

I know it has been a while since we went through all of this but I would really like the app to work as intended. I have no idea why it has suddenly stopped working - I have not even opened the project in a month, at that time it was working perfectly. Any help would be much appreciated.

Here is a link to the project.

https://x.thunkable.com/copy/32370fd8a39e85db591cb1c6dda6916d

the blocks in question are located on the ‘assignment’ screen.

Thanks!

1 Like

I just copied your project but could not find the Assignment screen.

1 Like

Sorry @muneer , its actually the ‘homework screen’.

@muneer update, I created a new project and copied the code from scratch and tested it. It does not work as well. I just wanted to check if there was some sort of glitch in my project that was preventing the code from working; I have had it before where you have to drag blocks in and out in order to make the code work. Therefore, it seems that there is somehow a error with the logic. This is very frustrating as the code was working fine earlier but now, without any additional changes, it is broken. Any help would be greatly appreciated.

Thanks! :slight_smile:

1 Like

Can you just refresh my memory?

When the screen opens, it executes a function (update assignments)
image
This in turn executes (get dates)
image

Up to this point, there are no loops, but the (get dates) function is using j variable which would fail.

1 Like

I tried adding a loop into that function but It is still does not work. Below, the compare dates function calls the get dates function which is in a loop. Therefore, the j variable would work as it is being called inside a loop.

1 Like

I have changed this function so that it only calls on the ‘compare dates’ function. You were correct in that I was called the ‘get dates’ function first and as that uses the ‘j’ variable, it would not work. I only need to call the ‘compare dates’ function as it already calls the ‘get dates’ function. However, despite this changes, the code still does not work.

In case you were confused about what my actual problem is, I will try and explain it. When a user creates an assignment, a status message should be joined onto the assignment depending on how close the current date is from the assignment due date. For instance, if the assignment is due the following day, the status message should be 'due tomorrow or if it is due within 3 to 5 days it should be ‘due soon’. However, what is happening now is no matter what date you set the assignment date to be, the status message will always return ‘due today’. Even if you set the assignment for 7 days time, it will say this. Remember that we created a function that converted the written date of the assignment into a numerical format. This is used to calculate the difference between the current date and the assignment date. When it is returning ‘due today’ as the status message, it is indicating that the the numerical format of the current date and the assignment date are the same.

I am sorry if I have not explained this clearly, please ask if I could explain anything further. And once again, thank you for your help.

1 Like

Hi Muneer, any help with this would be greatly appreciated as I need to complete this app very soon and as of to date, its core functionality is not working. I very sorry for any inconvenience I have caused.

Thanks! :slight_smile:

1 Like

Not ignoring you but got busy with others things. Will look into it and give you a reply tomorrow.

Many thanks for your patience.

1 Like