Page 1 of 1

Date to char transformation

Posted: Fri Jun 08, 2007 6:45 am
by just4geeks
Hi,

Input is YYYY-MM-DD
Column type is Date(10)

Output should be YYYYMDDD
Outout type is Char ( 8 )

How to remove '-' from input to get output in transformer or modify stage. I am trying to use string_from_date but it is not working.

Example: Input : 9999-12-31
outPut: 99991231

Thanks for help!

Posted: Fri Jun 08, 2007 7:16 am
by samsuf2002
You can use DateToString(In.Date,"%yyyy%mm%dd") change the sql type to char 8 in the output of transformer.

Posted: Fri Jun 08, 2007 7:37 am
by just4geeks
Hi,

I used this function..

DateToString(DSLink3.DATE1)

I got following error:

Transformer_10,1: Internal Error: (length <= result.length()):date/conv.C: 562: Output string is not long enough to accomodate this format.
Traceback: msgAssertion__13APT_FatalPathFPCcRC11APT_UStringPCci() at 0xd3d806c0
convert__27APT_Conversion_UString_DateCFPCvPvT2() at 0xd36436f4
processInputRecord__65APT_TransformOperatorImplV0S10_test_date_to_string_Transformer_10Fi() at 0xd978e0c4
runLocally__22APT_CombinableOperatorFv() at 0xd376003c
run__15APT_OperatorRepFv() at 0xd36876a8
runLocally__14APT_OperatorSCFv() at 0xd3674054
runLocally__Q2_6APT_SC8OperatorFUi() at 0xd36f54ac
runLocally__Q2_6APT_IR7ProcessFv() at 0xd3771c68
executePlayer__18APT_ProcessManagerFP16APT_ScoreProcess() at 0xd3739d54
executeStep__FPC19APT_PMMessageHeader() at 0xd3806ed0

Can you tell me if the function syntax is correct. Date1 is input column with Date(10) type.

Thanks!

Posted: Fri Jun 08, 2007 7:42 am
by DSguru2B
Did you give the conversion mask?

Posted: Fri Jun 08, 2007 7:44 am
by samsuf2002
Use DateToString(DSLink3.DATE1,"%yyyy%mm%dd") in your column derivation part , let the input be date (10) but in the output of transformer change it to char (8) .

Posted: Fri Jun 08, 2007 7:45 am
by rafik2k
Use convert or ereplace function in the transformer to remove "-" character from the input date like following

Code: Select all

Convert("-", "", DSLink3.DATE1) 

Posted: Fri Jun 08, 2007 7:46 am
by just4geeks
Hi,

Whats mean by conversion mask!

Input is Date1, data type DATE(10)
output is of data type CHAR( 8 )

Thanks,

Posted: Fri Jun 08, 2007 8:12 am
by DSguru2B
"%yyyy%mm%dd" is the conversion mask/code. Did you use that with DateToString()? From your previous post, it does not look like you used it.

Posted: Fri Jun 08, 2007 8:24 am
by just4geeks
Hi DSguru,

U r right. I did not use it. Can u please tell me How can I use it.

I just used this : DateToString(DSLink3.DATE1)

Thanks!

Posted: Fri Jun 08, 2007 8:39 am
by samsuf2002
You used this ---> DateToString(DSLink3.DATE1)
Now use this ---> DateToString(DSLink3.DATE1,"%yyyy%mm%dd")

Posted: Fri Jun 08, 2007 8:51 am
by just4geeks
Hi

I used the correct conversion mask code and it worked. also the the covert function also worked.

Earlier I tried with %yyyy-%mm-%dd% which was invalid.

Thanks all for help!!

Posted: Fri Jun 08, 2007 4:30 pm
by ray.wurlod
just4geeks wrote:Hi DSguru,

U r right. I did not use it. Can u please tell me How can I use it.

I just used this : DateToString(DSLink3.DATE1)

Thanks!
We haven't heard from U is a while, but I note that U is still a registered member.

The second person personal pronoun is spelled "you". The present tense plural form of the verb "to be" is spelled "are". Please take care to communicate professionally; it makes life easier for those posters (such as, one presumes, U from Burma) for whom English is not a first language.

Posted: Fri Jun 08, 2007 6:49 pm
by just4geeks
Hi All,

Iam extremely sorry if my unintended remarks are offensive to anyone. I did not mean them.

Warm regards,