Day of week -1
Post any question you may have in regards to GoAnywhere Director and let our talented support staff and other users assist you.
3 posts
Page 1 of 1
Hi, I couldn't find this in the forum. I have a project that retrieves the day of the week (ex Mon, Tue, Fri) using a timestamp task. Is there a way to get yesterday's day of week name? For example, if the project runs at 01:30am on Wednesday, I want to retrieve the value of Tue. Would this be a 2 or 3 step process - retrieve today's date, subtract one and then retrieve the day of week?
Thanks,
Thanks,
- Support Specialist
- Posts: 590
- Joined: Tue Jul 17, 2012 2:12 pm
- Location: Phoenix, AZ
-
The easiest way to do Date Arithmetic is to use SQL. To achieve the date calculations you're looking for you can perform the following:
Select DayName( Current_Date - 1 Day), Current_Date - 1 Day from SysIBM.SysDummy1
Note: This assumes that you're using an iSeries. SysDummy1 can be replaced by any SQL Table that has at least 1 record in that table.
There is a post on the Forum that eluded to a Utility Project called SQL Help. This utility allowed you to pass any valid SQL Select statement and get a returned value. You can see the Project in this post:
http://www.goanywheremft.com/forum/post ... 471cc#p418
This would allow you to do something like:
Select DayName( Current_Date - 1 Day), Current_Date - 1 Day from SysIBM.SysDummy1
Note: This assumes that you're using an iSeries. SysDummy1 can be replaced by any SQL Table that has at least 1 record in that table.
There is a post on the Forum that eluded to a Utility Project called SQL Help. This utility allowed you to pass any valid SQL Select statement and get a returned value. You can see the Project in this post:
http://www.goanywheremft.com/forum/post ... 471cc#p418
This would allow you to do something like:
Code: Select all
<callProject label="SQL Help" version="1.0" project="/Utilities/SQL Help" runInSameJob="true" inheritUserVariables="true" returnUserVariables="true" onError="setVariable:Error=1">
<variable name="SQLStmt" value="( Current_Date - 1 Day )" />
<variable name="Reply" value=" " />
</callProject>
<setVariable label="Set Yesterday" version="1.0" name="Yesterday" value="${Reply}"/>
<callProject label="SQL Help" version="1.0" project="/Utilities/SQL Help" runInSameJob="true" inheritUserVariables="true" returnUserVariables="true" onError="setVariable:Error=1">
<variable name="SQLStmt" value="( DayName( Current_Date - 1 Day ) )" />
<variable name="Reply" value=" " />
</callProject>
<setVariable label="Set DayName" version="1.0" name="DayName" value="${Reply}"/>
<print label="Status" version="1.0">
<![CDATA[
*===========================================================================================*
Yesterday was ${ DayName } - ${ Yesterday }
*===========================================================================================*
]]>
</print>
Rick Elliott
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696
3 posts
Page 1 of 1