I'm sure you're not getting the error merely when you say [Set x = TempList.pyLabel +"T000000.000"] . You may be getting the error later when you attempt to use your x as some kind of pattern. A detailed stack trace would help, and knowing what the full value of x is. Thanks. /Eric
From the stack trace, it looks like you have an activity setcorrectreceiptdate, and it has a when condition that calls FormatDateTime, and that's where things go off the rails. Could you show us what the code in the when condition which calls FormatDateTime looks like? Are you passing in the variable x from your initial post as one of the parameters?
Is TempList.pyLabel defined as a datetime property or a string? I know that pyLabel is generally a string and I don't see anything there at that would lead me to expect FormatDateTime to be called. If it is a datetime and you are appending a string, it may not even be so much the 'T' as any (string) char in that location that it doesn't like. You might need some sort of toString() function before the addition of "T000000.000".
Also, TempList.pyLabel = TempList.pyLabel + TempList.pyLabel +"T000000.000" is a bit confusing. Do you really mean to add the value of pyLabel to itself before appending "T000000.000"? So if TempList.pyLabel starts out as "8chrLong" and that means it goes through your property set.
And ends up as TempList.pyLabel = "8chrLong8chrLongT000000.000"
Definitely at that point, you don't have a datetime anymore.
Of course if you set TempList.pyLabel to @(Pega-RULES:DateTime).CurrentDateTime(), that should be longer than 8 characters, so the when should always return false. Have you looked at the generated java for line 518 of setcorrectreceiptdate to ensure that you're really going through the lines of code you expect?