This is an archive of the Maximo Yahoo Community. The content of this pages may be a sometimes obsolete so please check post dates.
Thanks to the community owner Christopher Wanko for providing the content.
Try this function... You might have to convert it to lowercase first though
http://stackoverflow.com/questions/196972/convert-string-to-proper-case-with-javascript
Chon
Thanks. I played around with this for about two hours and I think I finally got it. I used the 2nd js function on the page:
String.prototype.toProperCase = function () {
return this.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});
};
To use it in BIRT, create a new js (say "toProperCase.js") with the above listed javascript. Copy the js file to the BIRT Libary folder (e.g. C:\birt_232\reports\birt\libraries). This will allow you to refer to the js file in next step.
Open your report in BIRT designer and go to the Outline tab. Click on the rtpdesign file at the top of the outline list and this will give you a new set of options in the Property Editor dialog box. Click on the "Resources" tab and you get two dialog boxes to add custom JAR or JS files. Click 'Add' and select the js file you created from above.
Now insert a new Dynamic Text field and append the data value with the js function name - in this case ".toProperCase();"
So to set the field "PO.DESCRIPTION" to proper case, the dynamic text entry in BIRT would be:
row["description"].toProperCase();
Look for a full post on TUG site in the next day or two!
--- In MAXIMO@yahoogroups.com, Chon <cneth2000@...> wrote:
>
> Try this function... You might have to convert it to lowercase first though
>
> http://stackoverflow.com/questions/196972/convert-string-to-proper-case-with-javascript
>
> Chon
>
Jason,
If you select the table and then go to properties, advanced then find the text property and expand, look for Text transform and choose Capitalize. I think this will do what you wanted to do without code.
-Wes
Wes Williams
http://www.weswilliams.net
http://www.williamsconnell.com
________________________________
From: Jason Verly <jason.verly@yahoo.com>
To: MAXIMO@yahoogroups.com
Sent: Thursday, May 3, 2012 12:44 PM
Subject: [MAXIMO List] Re: Javascript for text string conversion to proper case in BIRT - Answered
Thanks. I played around with this for about two hours and I think I finally got it. I used the 2nd js function on the page:
String.prototype.toProperCase = function () {
return this.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});
};
To use it in BIRT, create a new js (say "toProperCase.js") with the above listed javascript. Copy the js file to the BIRT Libary folder (e.g. C:\birt_232\reports\birt\libraries). This will allow you to refer to the js file in next step.
Open your report in BIRT designer and go to the Outline tab. Click on the rtpdesign file at the top of the outline list and this will give you a new set of options in the Property Editor dialog box. Click on the "Resources" tab and you get two dialog boxes to add custom JAR or JS files. Click 'Add' and select the js file you created from above.
Now insert a new Dynamic Text field and append the data value with the js function name - in this case ".toProperCase();"
So to set the field "PO.DESCRIPTION" to proper case, the dynamic text entry in BIRT would be:
row["description"].toProperCase();
Look for a full post on TUG site in the next day or two!
--- In MAXIMO@yahoogroups.com, Chon <cneth2000@...> wrote:
>
> Try this function... You might have to convert it to lowercase first though
>
> http://stackoverflow.com/questions/196972/convert-string-to-proper-case-with-javascript
>
> Chon
>
Thanks. I tried that but that only worked on text that was mixed case - e.g. ALN data type. On fields where the datatype was UPPER the Captilize text transform ignored subsequent letters in the text string because the 1st letter was returned as already being a capital letter.
--- In MAXIMO@yahoogroups.com, wwilliams@... wrote:
>
> Jason,
> If you select the table and then go to properties, advanced then find the text property and expand, look for Text transform and choose Capitalize. I think this will do what you wanted to do without code.
> Â
> -Wes
>
> Wes Williams
>
>
> http://www.weswilliams.net
> http://www.williamsconnell.com
>
>
> ________________________________
> From: Jason Verly <jason.verly@...>
> To: MAXIMO@yahoogroups.com
> Sent: Thursday, May 3, 2012 12:44 PM
> Subject: [MAXIMO List] Re: Javascript for text string conversion to proper case in BIRT - Answered
>
>
> Â
> Thanks. I played around with this for about two hours and I think I finally got it. I used the 2nd js function on the page:
>
> String.prototype.toProperCase = function () {
> return this.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});
> };
>
> To use it in BIRT, create a new js (say "toProperCase.js") with the above listed javascript. Copy the js file to the BIRT Libary folder (e.g. C:\birt_232\reports\birt\libraries). This will allow you to refer to the js file in next step.
>
> Open your report in BIRT designer and go to the Outline tab. Click on the rtpdesign file at the top of the outline list and this will give you a new set of options in the Property Editor dialog box. Click on the "Resources" tab and you get two dialog boxes to add custom JAR or JS files. Click 'Add' and select the js file you created from above.
>
> Now insert a new Dynamic Text field and append the data value with the js function name - in this case ".toProperCase();"
>
> So to set the field "PO.DESCRIPTION" to proper case, the dynamic text entry in BIRT would be:
>
> row["description"].toProperCase();
>
> Look for a full post on TUG site in the next day or two!
>
> --- In MAXIMO@yahoogroups.com, Chon <cneth2000@> wrote:
> >
> > Try this function... You might have to convert it to lowercase first though
> >
> > http://stackoverflow.com/questions/196972/convert-string-to-proper-case-with-javascript
> >
> > Chon
> >
>
>
>
>
>
>