Page 1 of 2

Display the long name of the day

Posted: Tue Dec 14, 2010 10:11 am
by rajeevm
Hi All,

I am facing a problem with the Date format . My source has a issue_dt column . I have to check the date whether its sunday or not. If its sunday I have to change the Edition_Cd to 14 else pass the same edition code from source.

How do I check whether the given date is sunday
I really appreciate your help

Thanks
rajeev

Posted: Tue Dec 14, 2010 10:17 am
by vinothkumar
Check WeekdayFromDate function.

Posted: Tue Dec 14, 2010 10:25 am
by rajeevm
I checked that but the values are not passing thru the target

I used the following :

If WeekdayFromDate(To_New_isrt_trans.ISSUE_DT,'SUNDAY')
And To_New_isrt_trans.EDITION_CODE='01'
And IsNotNull(To_New_isrt_trans.ROUTE_CD)
then To_New_isrt_trans.EDITION_CODE='14'
else To_New_isrt_trans.EDITION_CODE

Please help me.

Thanks
rajeev

Posted: Tue Dec 14, 2010 10:31 am
by chulett
Your syntax for the WeekdayFromDate function is incorrect. Recheck the documentation and adjust accordingly.

Posted: Tue Dec 14, 2010 10:35 am
by rajeevm
The syntax shown in the document as Date(Origin day) I could not able to understand . Please let me know the correct syntax.

Thanks
rajeev

Posted: Tue Dec 14, 2010 10:38 am
by vinothkumar
stageVar=WeekdayFromDate(To_New_isrt_trans.ISSUE_DT)
If the value of stageVar is 0 then it is Sunday I beleive. That you can test with a sample value. As a whole, this function will return the Day number (i.e 0 -Sunday , 1 - Monday,.....)

Posted: Tue Dec 14, 2010 10:43 am
by chulett
Pass in the date and it will pass out the weekday number, 0 thru 6, where 0 = Sunday since sunday is the default 'origin day'. There is also a way to override the origin day if you want the week to start on a different day like Monday but I wouldn't worry about that in your case.

Posted: Tue Dec 14, 2010 10:53 am
by rajeevm
I know that it gives the day number how to check that the given date is sunday . So I need to change the syntax as below

If WeekdayFromDate(To_New_isrt_trans.ISSUE_DT) =0 And To_New_isrt_trans.EDITION_CODE='01'
And IsNotNull(To_New_isrt_trans.ROUTE_CD)
then To_New_isrt_trans.EDITION_CODE='14'
else To_New_isrt_trans.EDITION_CODE


So is this way I should proceed

Please let me know.

Thanks
rajeev

Posted: Tue Dec 14, 2010 11:50 am
by chulett
Yes.

Posted: Tue Dec 14, 2010 12:45 pm
by rajeevm
Hi chulett,

If I proceed the way I mentioned earlier . The data is not getting correctly into the target.

If its sunday then Edition_Cd=14 and Route_cd ='B:Route_Id'

Now , the data is loading in this way Way Edition_Cd=0 and Route_CD=B:Rout

Was there anything wrong in the syntax.

I really appreciate your help

Thanks
rajeev

Posted: Tue Dec 14, 2010 1:38 pm
by vinothkumar
How about the other 2 clauses that you gave in IF condtion. Are they true for your current scenario

Posted: Tue Dec 14, 2010 1:42 pm
by rajeevm
yes they are true

Posted: Tue Dec 14, 2010 2:08 pm
by chulett
There's no "and" after the "then". Do the Sunday check in a stage variable and then check it in both field's derivations.

Posted: Tue Dec 14, 2010 2:20 pm
by rajeevm
No the sunday is checked in the derivations against two columns

For Edition_Cd Column

If WeekdayFromDate(To_New_isrt_trans.ISSUE_DT) is Sunday
And To_New_isrt_trans.EDITION_CODE='01'
And IsNotNull(To_New_isrt_trans.ROUTE_CD)
then To_New_isrt_trans.EDITION_CODE='14'
else To_New_isrt_trans.EDITION_CODE

For Route_cd Column:

If WeekdayFromDate(To_New_isrt_trans.ISSUE_DT) is Sunday
And To_New_isrt_trans.EDITION_CODE='01'
And IsNotNull(To_New_isrt_trans.ROUTE_CD)
Then 'B:To_New_isrt_trans.ROUTE_ID'
Else To_New_isrt_trans.ROUTE_ID

I tried your syntax chulett but still not working .

Kindly please help me out with this.

Thanks
rajeev

Posted: Tue Dec 14, 2010 4:02 pm
by chulett
Where did "is Sunday" come from? You need to check for "= 0" as you posted earlier.