Passing Date as parameter to child pipeline which is google analytic snap

Hi,

I’am trying to pass date as parameter to child snap(which is google analytic snap) and receive the value in startdate and enddate filed on the Snap, however I’m unable to retrieve the same.

the pipeline parameter value by default is a string. In the master pipeline , convert the date to a string. In the child pipeline always convert the string back to datetime as needed.

One could also use the expression library , to put a generic date conversion function, that can then be used in your pipeline. Using this approach could make it easier for maintenance as you have one place to change your date algorithm.

For example you could create an expression library file of the form

{

/* 
 Process prev month data only
*/

sl_prev_month_start_string: x => (Date.parse(Date.now().getFullYear() +"-"+ ( Date.now().getMonth() - 1 ) +"-01")).toString().split("T")[0] ,
sl_prev_month_end_string: x => (Date.parse(Date.now().getFullYear() +"-"+ ( Date.now().getMonth()) +"-01").minusSeconds(1)).toString().split("T")[0]

}

for example i save the above as a file and in the pipeline properties i can reference it as shown below

In your mapper or other snaps where expressions are enabled you can invoke the method (you can pass a parameter to this function as required. Also refer to https://docs-snaplogic.atlassian.net/wiki/spaces/SD/pages/1438110/Expression+Libraries for more details .