Get data from URL based sysdate-1

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
Vrisha
Premium Member
Premium Member
Posts: 60
Joined: Sat Jul 15, 2017 9:32 pm
Location: Texas,USA

Get data from URL based sysdate-1

Post by Vrisha »

I am able to pull the date from URL if 'https://dart.service-now.com/api/now/ta ... _value=all' using Hierarchical stage.

Now the requirement is to get previous day data from the url

"https://dart.service-now.com/api/now/ta ... 2017-08-01[/b]^ORDERBYsys_updated_on&sysparm_display_value=all"

If today is 22nd August, I need to pull 21st August data.( Rule is Sysdate -1)

How to store the current date in job parameter. Please let me know
Suja
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

How are your launching / triggering this job? Is there a Sequence job in the mix or if not, can there be? It can set the parameter for you. If there is a script involved, it can do it as well.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Vrisha
Premium Member
Premium Member
Posts: 60
Joined: Sat Jul 15, 2017 9:32 pm
Location: Texas,USA

Post by Vrisha »

Thanks for your response,Craig.

Yes , sequencer is involved to run the job.

As I am giving the url 'https://dart.service-now.com/api/now/ta ... d_on%3E=[b] 2017-08-01 [/b]^ORDERBYsys_updated_on&sysparm_display_value=all" in the Hierarchical stage -->EditAssembly-->REST step--> General-->URL, I want to pass the 'sysdate -1' as a parameter in the job.

Can we set the (sysdate-1) in the job parameter for the job or we need to do only using User variable activity in sequencer. Please let me know.
Suja
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

If you are asking if you can set something in the parameter's value to automatically set itself to "sysdate-1" the answer is no. There are different ways off the top of my head to get that date and yes, the User Variables stage would probably be the most "proper" place to do it. Technically an Execute Command stage could do something at the O/S level to pass back that date for the Execute Job stage or if you feel like writing a custom routine, you could leverage a Routine Activity stage. The Sequence job could then pass the output of either directly to that job parameter before it launches the job.

Another way would be to use a parameter set leveraging a value file where you write yesterday's date to the file (using your tool of choice) and then it gets automatically consumed by the job.
-craig

"You can never have too many knives" -- Logan Nine Fingers
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

To add to this, the system variable @DATE gives you the date that the job started in internal format. You could then use OConv to convert it to "external" format, a string in whatever shape you need it to be after you subtract one from it.
Last edited by chulett on Tue Aug 22, 2017 3:00 pm, edited 1 time in total.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Vrisha
Premium Member
Premium Member
Posts: 60
Joined: Sat Jul 15, 2017 9:32 pm
Location: Texas,USA

Post by Vrisha »

Thank you, Craig.

I will try with User Variable activity and get back to you.
Suja
Vrisha
Premium Member
Premium Member
Posts: 60
Joined: Sat Jul 15, 2017 9:32 pm
Location: Texas,USA

Post by Vrisha »

Used the UserVariable activity stage in Sequencer to get the current date as
Oconv(@DATE,'D-MDY[2,2,4]'). Called this Current Date as a parameter in the job to retrieve the data from URL.

The problem is solved.
Suja
Post Reply