Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I am having week as 'w1'. I need it to be written as 'W01'.
Is that possible? and could you please suggest me the logic?
Thamks & Regards,
Vinitha Mano R.
Please see the attached example. You would use the code something like this:
LEFT(WeekField,1)&0&RIGHT(WeekField,LEN(WeekField)-1) AS Final
If it was only a 0 for 1-9 and then no zero there after you can sort that with an IF statement.
Let me know if that works.
Dan
This could actually be simplified to:
'W'&0&RIGHT(WeekField,LEN(WeekField)-1) AS Final
Daniel Roberts is on the right track, but both of his solutions add an extra zero for any week greater than one digit (for w10, both of his return w010).
To avoid having the extra 0, here is another option (example.qvw also attached):
'W'&num(PurgeChar(Week, 'w'),'00')
Try like this
=Num(Num#(FieldName, 'w##'), 'W00')
or
='W' & Num(Num#(Right(FieldName, Len(FieldName) - 1), '##'), '00')
Try this
='W'&num(PurgeChar(Week, 'w'),'00')
There are countless ways. Here is one more:
='W' & num(mid(Week,2),'00')