A common piece of functionality in most programming languages is a search and replace character function; the more sophisticated languages allow for regular expressions. In any case, here’s how to do a search and replace character in a string using WebFOCUS:
This one was was buried in a forum thread. Note that this is as of WebFOCUS 7.1.3.
WebFOCUS is a rich language that you can do almost anything with. Unfortunately, the depth of the language makes it hard to find how to do certain tasks; I’ve had to search very hard in our documentation, Focal Point, and Google to accomplish what I would consider common tasks.
Here’s an example. When I first started to learn WebFOCUS, I was trying to show the leading zero of a fractional 0 value in a report.
I.e. a zero real value shows up like .00 instead of 0.00.
In most cases that’s fine to save real estate. However, I like it with the leading zero to help with visually aligning decimal places. Simple enough task right? It is, but you have to know the right command and what to search for.
I searched for (always preceding with WebFOCUS):
• Add a zero to a real number in a report
• Suppressing zero values in report (the opposite)
• Formatting numeric values
It took a while (20 minutes), to find what I was looking for. It was:
SET CENT-ZERO = ON
It’s easy to do, just hard to find how to do it.
This got me thinking; I thought it would be useful to start blogging about various features I’ve found and sharing them with Google. The trick is adding the right keywords to make it easier to find things.
Hopefully, everyone can benefit from this activity. I know I will when a have a mental lapse. 😀