Portal Engine Questions on portal engine and web parts.
Version 6.x > Portal Engine > Transformation Script in Repeater View modes: 
User avatar
Member
Member
Jaykzoo - 10/5/2012 4:19:01 PM
   
Transformation Script in Repeater
hello,

I have a transformation that has a script to translate a month field into some quarter text. It works correctly on only the first item in my repeater, the rest of the items are not affected. Is there a different way this should be accomplished?

Here's the relevant code:
<script runat="server">
string GetQTR(object CodeName) {

if (CodeName != null) {
string Code = CodeName.ToString();
switch (Code) {
case "1": return "FIRST QUARTER";break;
case "2": return "FIRST QUARTER"; break;
case "3": return "FIRST QUARTER"; break;
case "4": return "SECOND QUARTER"; break;
case "5": return "SECOND QUARTER"; break;
case "6": return "SECOND QUARTER"; break;
case "7": return "THIRD QUARTER"; break;
case "8": return "THIRD QUARTER"; break;
case "9": return "THIRD QUARTER"; break;
case "10": return "FOURTH QUARTER"; break;
case "11": return "FOURTH QUARTER"; break;
case "12": return "FOURTH QUARTER"; break;
}
}
return (string)CodeName;
}
</script>

<%# GetQTR(GetDateTime("ReleaseDate", "MM")) %> <%# GetDateTime("ReleaseDate", "yyyy") %>



thanks

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 10/7/2012 10:08:44 AM
   
RE:Transformation Script in Repeater
Hello,

Could you please let me know, where you are placing this code? Is it placed to the transformation directly? Is the code executed and the CodeName returned on all other occasions? Have you tried to place this code in a custom transformation function to debug it there? This way you can use Visual Studio to run the site in debug mode to see, how it behaves.

Best regards,
Boris Pocatko