[Solved] Help With Previous Week & Next Week Data?

Hello Bubble experts :wave:

Can anybody help me showing next & previous week data in Repeating group when clicking previous & next week button?
I am unable to figure out the logic :thinking:

This is my database data which i want to show
Screenshot 2022-09-27 at 19.25.23

Thanks in advance for your help :pray:

[EDIT] There are 2 solutions in this, Post 3 & Post 6 by @mikeloc

1 Like

not going to beat @mikeloc to the answer today… but you are in good hands… the answer is rapidly approaching you :slight_smile:

1 Like

Hi there, @mdburhan3… one way you could go here is to set a custom state (date range) when a button is clicked, and then use the custom state’s value as a conditional constraint on the repeating group’s data source. For example, setting the custom state when the This Week button is clicked would look like this…

Then, you could have a condition on the repeating group that says when that custom state’s value isn’t empty, do a search for events with a constraint where the created date is greater than or equal to the start date of the custom state’s range and another constraint where the created date is less than the end date of the custom state’s range. Make sense?

Hope this helps.

Best…
Mike

P.S. Too kind, @bubble.trouble… too kind.

2 Likes

Hi @mikeloc
Thanks for the response :+1:
I will try this & let you know…

1 Like

@mikeloc Thanks once again :+1:
I followed exactly you wrote…
It works for my “This week” data…

Screenshot 2022-09-27 at 20.17.45

How can i setup previous & next week data?

Setting the custom state for the previous week would look like this…

… and you should be able to figure out the expression for the next week. :slight_smile:

1 Like

@mikeloc Thanks it works :+1:

For the next week this is what i did (It works when i tested just want to show you & i hope it is Okay)

Screenshot 2022-09-27 at 20.31.20

Yup, looks good. Oh, and I think you might need to blank out the other two custom state values when any of the buttons are clicked.

1 Like

@mikeloc Thanks a lot :+1:
I don’t know how to mark your 2 answers as a solution :thinking:

Also
I am waiting for your reply from previous post :upside_down_face:

1 Like

Hi one question, how did you get “( )” brackets after range? as i’m trying to add :round down to week but its not showing in the list so there must be a way to get ther

Hello @imotech

You can enable brackets from Settings section >> Version Tab

I tried doing this formula but cant get passed the Current Date after the <-range->. I dont have the option rounded down to

image

Help please :pray:

You need to turn on parenthesis (refer to the post directly above yours)

1 Like

Ahh, its an experimental feature. Gotcha! Thank you @tylerboodman!

How do you manipulate the parenthesis? It kept putting the first condition before the <-range-> in the parenthesis instead of the last one