StringTheory / StringFormat - how to display blank string?

I think I’m missing something simple.

I need to display 6 or 7-digit numbers unformatted (no commas).
So I display them as @S11 in a NetWeb browse.

But for numbers that are zero (or null), I want to show a blank. My browse shows them as zero.

Is there a magic format string to do that?

Right now, I’m using this for the format string on the browse field. Is their an easier approach?

CHOOSE(umD:patientId = 0 OR NULL(umD:patientId),'@S0','@s11')

Greetings Ms Jane -

For leading blanks when you got a number:
= CHOOSE(umD:patientId = 0 OR NULL(umD:patientId),‘’,FORMAT(umD:patientId,‘@N_7’))

IF you need the number left justified then TRIM(LEFT(FORMAT(umD:patientId,‘@N_7’))) without leading zeros or blanks

IF you need leading zeros FORMAT(umD:patientId,‘@N07’)

There is also a FORMAT(umD:patientId,‘@N07B’) This will print you a 7 digit number, leading zeros and blank it if zero, make sure it works with the nulls

So you might still need the choice.

= CHOOSE(NULL(umD:patientId), ‘’, FORMAT(umD:patientId,‘@N07B’))
= CHOOSE(NULL(umD:patientId), ‘’, FORMAT(umD:patientId,‘@N07’))

Regards,
Roberto Artigas

Thanks for the suggestions, Roberto. But so far, not what I want.

The template code is using p_web.FormatValue, which leverages the StringFormat class and its extended pictures.

The numeric pictures you specify all seem to insert a separator - whether comma, period, or space. And that’s why I’m using an @S picture - I just want it displayed as a string. But blank if the number is 0 or NULL.
I haven’t taken the time to investigate, but I’m guessing that even though I specify a @String picture in the browse template, the templates are checking the dictionary and deciding that the underlying data is a LONG.

I’m not at my computer today, so i cant test, but have you tried @n_7b

Yes! Thanks, Bruce.

The built-in picture editor in the Embeditor doesn’t give that option, so I’m assuming that’s part of the extended pictures?

Now I just need John to finish his AI processing of all Capesoft docs so I can find such answers. (I did spend more than my standard 48 seconds parsing through them :wink: )

My second suggestion was:
TRIM(LEFT(FORMAT(umD:patientId,‘@N_7B’))) with umD:PatientID = 567
After FORMAT ’ 567’
After LEFT '567 ’
After TRIM ‘567’
Going from memory recall…
Not in the VM…

Doing an FORMAT(umD:patientId,‘@N07B’) with umD:PatientID = 12345
Will get you an ‘0012345’ and a blank with umD:PatientID = 0