Update items by day

Created on 7 February 2024, over 1 year ago

Hello,

I have a feed that imports items every 1 hour.
As it creates a large amount of items (24 by day) I would like to keep only the last item every day.
The best way is to create a date only field and to mark it as unique, so that the feed should update one item every hour and create a new one the next day.

Is there any way to do that ?

PS:
I tried to use tamper to set the date only field (format Y-M-D) from Timestamp to date but the website hangs with this error:

Drupal\tamper\Exception\TamperException : Input should be numeric. dans Drupal\tamper\Plugin\Tamper\TimeToDate->tamper() (ligne 62 de /web/modules/contrib/tamper/src/Plugin/Tamper/TimeToDate.php).

Thanks

💬 Support request
Status

Active

Version

3.0

Component

Miscellaneous

Created by

🇧🇪Belgium jbfelix

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @jbfelix
  • Status changed to Fixed 16 days ago
  • 🇳🇱Netherlands megachriz

    The Tamper "Unix timestamp to Date" requires indeed a number as input.

    What you could do is the following:

    1. Map a blank source to your date (or text) field.
    2. Add the Tamper "Set value or default value" and set the value to "now".
    3. Add the Tamper "String to Unix Timestamp", this will convert "now" to the current time.
    4. Add the Tamper "Unix Timestamp to Date" (with for example the format "Y-m-d"). You'll get the current date.

    If you set the mapping target as unique, I think you'll get one item each day.

    Do note that you could possibly get duplicate items imported in case the item on day 1 is the same as on day 2.

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024