Skip to content
+1-888-319-3663

COMMUNITY FORUM

DataSource executing when opening a map.

Julie asked 5 years ago
I have a MAP in which the datasource is a SQL SP.  This procedure parses some data and marks it as being processed in a SQL table.  The problem is, everytime I open the map it seems to be running the DataSource and I don’t want it to run when I open the map, only when I “Run” the map.  I have several post steps and these are not getting executed unless the map is run.  Therefore I have records marked as being processed when they actually havn’t been.
Answers
Patrick Roth Staff answered 5 years ago
Julie,
Whenever you open a map, SC executes the data source to verify that the columns exist (I’d rather it not actually but that’s what it does).
So in your case, it executes your stored proc which then does whatever it does.
So a suggestion i’d have is to add a param to your proc (perhaps integer)
In the proc, if the value is 0 then return
select top 0 A,B,C, etc
So that SC has the params it needs to map.
Otherwise do your normal logic.
Next – create a global variable and assign it a value of perhaps 0.
In your data source, put in the global in the query
Now make a Before Map task and it it set the global to 1
If the map hasn’t run, then the global would be 0 and your logic in the proc doesn’t pull and mark the data.
if the map does run, the map Pre task executes setting it to 1.  then in the query, 1 is passed and it pulls the data as expected.
 
Julie replied 5 years ago

Thanks, works perfect


If you would like to submit an answer or comment, please sign in to the eOne portal.