DataView Filter by Date, and Dynamic Binding on Repeats

I have a Data View that I’d like to filter on a dateTime value.
WHat’s the correct way to use something like filter=“scheduled_on >= NOW()”

<dmx-data-view id="data_view_Upcoming" dmx-bind:data="getConsSessions.data.getConsSessions" filter="scheduled_on >= NOW()"></dmx-data-view>

I tried a couple of things, didn’t go through.
Thank you :slight_smile:

In App Connect there is no NOW() available. To get the current date time you need to add the date and time component on the page:

Screenshot 2021-12-09 at 9.16.39

1 Like

Thank you Teodor, this works really well.
All the best, this can be closed :slight_smile:

To continue on this topic, is there a way to dynamically change the Data View source of a binding.
Case in point, I have made 4 Data Views from a Server Connect. All good there.
image
Now I also have made 4 collapses, which are all the same but connected to each Data Views, and each collapse shows on a button click.
image
Each look like that:
image
Not the most efficient, especially when making updates x 4.
Is there a way to switch the dmx-bind source to a single collapse on the button click, instead of showing/hiding each of the 4 collapse?
Thank you

Does anyone have an idea to make dynamic binding for repeats?

You can use 1 collapse with 4 conditional regions with a repeat inside each of them.

Thanks @Teodor. But this that is still repeating the same code 4 times in each repeat. I’d like 1 repeat where the binding is changing

Using conditional regions the code wont be rendered in the DOM.

Right and that’s great. But it still requires having 4x pretty complex regions in the code, exactly the same for each repeat bound to each of the 4 Data Views. I’m trying to not have to do 4x any change I make to the repeat region.
By having 1 repeat, and changing the dmx-bind:repeat="" dynamically changed on click, I can avoid the 4 x same code above.Is there a way to do that?

Why did you create 4 data store components then? Why not use one and just filter it dynamically?

I created 4 Data Views. They have different filters, ex below isBooked = 0 or = 1
If I only need one and there is a way to dynamically change the filter onClick of a button, great, how is this done?

image
image

Thank you :slight_smile: