Page 1 of 1

HOW CONCAT "0 " IN MONTH TRANSFORMER

Posted: Thu Feb 25, 2016 9:19 am
by andregomes
Good Morning,
I have a date field that shows the month and year , but the format is that way, " 12016 " but I want to show this way " 012016 " as include 0 left on the date ? I use the transformer the clause " Cats ( Oconv ( DataAtual , " DM [ 2 ] " ) , Oconv ( DataAtual , " DY "[4] ) ) " to generate the data .

thank you.

Posted: Thu Feb 25, 2016 10:25 am
by chulett
Cats? :?

Why not just do it all at once?

Code: Select all

Oconv (DataAtual, "DMY", "[2,4]") 
Now, that's off the top of my dusty head but should get you pretty close. That may leave a space between the two but you can use Convert to remove it.

Posted: Thu Feb 25, 2016 10:28 am
by andregomes
Thank you before was that way with CATS, had already made ​​the move to Oconv ( DataAtual , " DMY " , " [2.4 ]" ) ---- but not yet solved the problem of the month , I believe it is something in sql server

Posted: Thu Feb 25, 2016 10:33 am
by chulett
Not sure what this conversation has to do with SQL Server.

So what happens if you use the code I posted, what is the resulting string?

Posted: Thu Feb 25, 2016 10:39 am
by andregomes
Same result, "12016" i need to " 012016"

Posted: Thu Feb 25, 2016 10:47 am
by chulett
We know what you need. What is your target data type? It needs to be a string and I suspect you are putting it into a number which strips the 'not significant' leading zero. If you are using a string then post the actual code you are using, copy/paste from the transformer (don't hand type it).

Posted: Thu Feb 25, 2016 11:00 am
by andregomes
Sorry, In the field is string database ( 6) in the transformer also like to know that the transformer is with drawing 'not significant ?

Posted: Thu Feb 25, 2016 2:36 pm
by ray.wurlod

Code: Select all

Oconv(DateActual, "DMY[2,4]" : @VM : "MCN")