Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Everyone,
I am trying to enter the below If condition in Load Script and it not working because of not using Escape Sequence.
if(today() >= [Calendar day] , 'Week' &' '&Week([Calendar day]) &'('& Year([Calendar day])&')' )
Could some one tell me best way to use the above condition.
Thanks in advance!
Your correct!
[Calendar day] was not read as Date properly.
Hence I used this condition -
if(today()>=date#("Calendar day",'DD.MM.YYYY'), 'Week' &' '&Week(date#("Calendar day",'DD.MM.YYYY')) &'('& Year(date#("Calendar day",'DD.MM.YYYY'))&')' ) as Week_Cal
Assuming you need to create an extra field by using the if statement, if so, you need to drop the "=" character and use something like below:
TableName:
Load
[YourFields],
if(today() >= [Calendar day] , 'Week' &' '&Week([Calendar day]) &'('& Year([Calendar day])&')' ) as [New Field]
From <YourSource>;
Otherwise, please provide a clear explanation, i.e., the purpose, your expectation, sample dataset, etc.
Can you share a script where this doesn't work? I don't see a need for escape sequence here.
Sunny,
I am trying to create date field "Calendar Day" into columns as week in Pivot table like shown below -
Week 1(2020) | Week 2(2020) | Week 3(2020) | Week 4(2020) |
If I use the below condition in front end of scripting its working fine, but that slows down the table when loaded.
if(today() >= [Calendar day] , 'Week' &' '&Week([Calendar day]) &'('& Year([Calendar day])&')' )
So now I want to use this condition in load Script, when I use the above condition in Load script. It appears as -
Week() |
and it sums all week.
So I thought escape sequence can act well in this case.
I am not seeing any issues with your script... is you field [Calendar day] read as date?
Your correct!
[Calendar day] was not read as Date properly.
Hence I used this condition -
if(today()>=date#("Calendar day",'DD.MM.YYYY'), 'Week' &' '&Week(date#("Calendar day",'DD.MM.YYYY')) &'('& Year(date#("Calendar day",'DD.MM.YYYY'))&')' ) as Week_Cal