That's a good tip, Miguel. For anyone that has never used this tool, it's helpful that this feature inserts the code sample using a monospaced font and a lightly-shaded background, and it also automatically colors the inserted code in a similar manner as the PowerScript editor, which is nice. You can choose from several other development languages, but PowerBuilder is the default. SQL is not one of the supported languages, unfortunately.
One drawback that everyone needs to be aware that when using the "Insert/edit code sample" tool, each tab character get translated into eight spaces.
// This comment preceded by a single tab character.
If IsNull(as_customername) Then Return -1
You'll see this translation when you paste the code into the dialog that opens up. It's rather annoying... Nobody writes code where a tab character translates into eight spaces.
Hmmm, when I copy the space in front of you comment and paste it into notepad++, I'm getting a TAB !?
I seem to have read in some Python discussions about spaces vs tabs, they actually agreed on 8 spaces for a tab. The only reason to use spaces for me, is when you'd be working on some kind of open source project and everyone has agreed to use spaces. But indeed, 8 is ridiculous and annoying.
To be more correct, I should have said that Tab characters are represented by the equivalent of eight spaces. You are correct that the actual tab characters remain in place. Thank you for catching that! Whenever I use this feature, I try to manually replace each tab with three spaces, mainly because the display width of the postings in this forum is a bit restrictive.
Still, it's a useful feature and I hope more members will use utilize it.