How can I filter by date from a collection where the date is part of an addon from Xano

Hi All

I’m new to Weweb and the terminology, not a programmer, I managed to learn it pretty quick anyway :grinning:, I am struggling trying to filter a collection by date, where the date field is returned from another table (Addon in Xano API), I cannot reach the date field in the filter section, as I can only access the entire object (returned by the addon). I’d appreciate your help,

This is the Xano API result, you can see the Addon that includes the date highlighted:

When I try to filter the collection, I cannot reach that field, is there another way solution where I can do that?

Thanks!!!

2 Likes

I’m looking for a solution to this too.
I asume that a way is to create a column in the table that shows the date (so you bring this data to the surface) to filter, but not sure if this is the best way to do it.

I have an Addon where I’m accessing the ‘last_active’ date property and then filtering if ‘last_active’ is greater than 2 days ago.

I apply the following code to the Collection List

// Access the global variable containing the data
const items = collections['c0876745-e0f1....de439c6947c9']['data']['items'];

// Get the current timestamp
const currentTime = Date.now();

// Calculate the timestamp for 2 days ago
const twoDaysAgo = currentTime - 2 * 24 * 60 * 60 * 1000;

// Filter the items based on the 'last_active' property
const filteredItems = items.filter(item => {
  // Check if 'last_active' property exists and if it's greater than 2 days ago
  return item._content_of_user.last_active && twoDaysAgo > item._content_of_user.last_active;
});

// Return the filtered items
return filteredItems;

The other method is to add the property as an Eval in Xano.

1 Like

Hey @plucky00 :wave:

That’s a known issue on our side: nested filters (aka the ability to filter on nested objects).

We’re planning on adding this feature in a few weeks. In the meantime, a frontend filter like @MichaelLovell suggested seems the right solution!

2 Likes

Thanks for yor answer @MichaelLovell and @Quentin!! :+1: :+1: I will try the JS code solution or doing the filter in Backend.

Hi @Quentin, just finding this thread as I’m running into the same issue. Did this feature get added? Still seem to be unable to access nested objects.

It’s in the roadmap, but I don’t have an ETA yet. I’ll keep you updated.

Did this planned feature get shelved?

1 Like

Same question^