1

Is there any opportunity with Importer to remove records that didn't get updated in the last X time frame?

I understand the scope of the product is to just pump in records, but I'm having a real issue where my imported records have a "shelf life" and if I could simply tell it to remove any records from the channel that hasn't been updated in X time frame, it would make my life a lot easier (read: get the client off my back :P ).

4

I had similar needs some time ago and importer may have changed but it wasn't possible.

What I ended up doing was adding an expiry time to the data imported like today + 24 hours then mapping that to the expiry field. The cron runs every day and if an entry isn't included it will simply expire meaning it won't be available.

Has worked flawlessly for a couple of years now.

UPDATE: The site imports data daily. The data is supplied via customers database. We use Importer from solspace to call on that data and if it finds a record that existed we use the new expiry date within the data.

So lets say we have 2 entries in EE like

-- Entry01, Some field, some other field, Expiry date (today+24 hours)
-- Entry02, Some field, some other field, Expiry date (today+24 hours)

When Importer runs the next day (the data has been updated at their end) the only entry that still exists is 'Entry01' - So within EE 'Entry01' will be updated inc. new expiry date but 'Entry02' wasn't updated in the import so it will naturally expire.

This is all based on a daily import, it could easily be weekly, monthly or whatever – the key is setting the expiry date when you import the data.

CRON is a server side behaviour that runs a particular command at any given interval. Importer gives you the code for the CRON to use, you then set the timing in the CRON and off it goes.

  • Interesting! You lost me with running the cron though. What do you mean 'if an entry isn't included'? – 86Stang Jan 29 '14 at 0:32
  • Updated my answer :) – stuartmcd69 Jan 29 '14 at 5:52
  • I know what CRON jobs are, your wording just lost me is all. :) Thanks for the clarification. My imports run hourly so I'll have to adjust accordingly but I believe this will work. Thanks for the assist! – 86Stang Jan 29 '14 at 16:12
0

If you can't include an expiration date with your imported data, you can use the Auto Expire plugin - https://devot-ee.com/add-ons/auto-expire

I have it set up so that all entries in my channel expire after 1439 minutes (23h59m). The cron runs every 24h and re-populates the entries.

0

I have a similar issue with a daily import where older entries need to be removed. Unfortunately the Auto Expire plugin doesn't seem to add expiration to entries imported (at least for me).

Our setup is to have the Importer setting 'Duplicate Entry Action' set to 'delete old, insert new' and then make use of the start_on parameter:

{exp:channel:entries ... start_on = "-24 hours"}

Not the most elegant solution as it does leave entries undeleted in the CP and you do start to get ID numbers in the high numbers.

However, to delete old entries, I'm currently experimenting with Purge Data plugin as mentioned here: https://expressionengine.stackexchange.com/a/25233/2782

(EE 2.10.1 and Solspace Importer 2.2.5)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.