Support forums

Please check @brandnewbox_uk for support status updates.

Search     Advanced Search
Automate DataGrab based on dates  
Posted: 15 September 2017 07:21 PM —  
Newbie
Rank
Total Posts:  13
Joined  2010-08-20

Hi, Andrew. CSVGrab had the ability to integrate PHP with a template in order to automatically import a new dated file via cron, like this:

{exp:csvgrab url="http://www.sitename.com/folder/{current_time format="%Y%m%d"}.csv”

Can DataGrab do something similar to this in the configuration (which didn’t work for me)?

http://www.sitename.com/folder/{current_time format="%Y%m%d"}.csv

As opposed to a static path like this?

http://www.sitename.com/folder/staticfile.csv

Scott

Profile
 
Posted: 16 September 2017 06:08 PM —   [ # 1 ]  
Administrator
Avatar
RankRankRankRank
Total Posts:  1339
Joined  2006-04-12

You should be able to use the run_saved_import tag:

http://brandnewbox.co.uk/support/details/expajw_datagrabrun_saved_import_tag

This lets you run a saved import from a template (ie, you must already have set the import up and saved it with the Control Panel) .

You can then change the file using the filename parameter:

{exp:ajw_datagrab:run_saved_import 
  id="2"
  filename="newfile.csv"
}

 

Profile
 
Posted: 18 September 2017 09:02 PM —   [ # 2 ]  
Newbie
Rank
Total Posts:  13
Joined  2010-08-20

Thanks, Andrew. I’m glad it has that potential. The following code with Allow PHP set to Yes and PHP Parsing Stage set to input:

{exp:ajw_datagrab:run_saved_import
id="7"
filename="{current_time format="%Y%m%d"}.wnj.de”
}

Produced this error on a manual view of the template:

The webpage at http://www.mddcnews.com/index.php/feeds/notices4 might be temporarily down or it may have moved permanently to a new web address.
ERR_CONTENT_DECODING_FAILED

And this error within the control panel:

A PHP Error was encountered
Severity: Warning
Message: Division by zero
Filename: ajw_datagrab/mcp.ajw_datagrab.php
Line Number: 84

Any other suggestions?

Profile
 

‹‹ Creating XML imports: use field names as XML tags?      There are 0 fields per entry (DataGrab 2.4, EE 3.5, XML) ››

Select A Theme