code within an html form
David Thompson
dthmpsn1 at uiuc.edu
Mon Apr 7 17:57:44 PDT 2008
>What I am trying to do is put parentheses around
>the text field ³Yr² only if there is a year in
>the field. If the field is empty, then I don¹t
>want anything showing up on the html form. Here
>is what I have tried. The code words fine if I
>just put in the parenthesis statement without a
>condition.
>
>{Name+?(Type="R","",?(Yr>² ³," ("+Yr+")",² ³))}
>
>Type is text that can be T, F or R. If it is R,
>then there is no name posted. If there is a
>name and the year exists in the field, I want it
>to look like this:
>(10), so that I would have Jim Smith (10), if
>there is no year in the field, it would just
>have Jim Smith.
>
>Any suggestions would be appreciated.
I'm not sure if that's the way that you actually
wrote it, or if your email has changed some of
the straight quotes to curly quotes. (In this
email the curly quotes may look like something
else altogether.) If those really are curly
quotes, they appear to be in the wrong order. You
seem to be opening the quotes with a close quote,
and closing with an open quote. I see no reason
why
{Name+?(Type="R","",?(Yr>" "," ("+Yr+")"," "))}
shouldn't work. The formula above just uses
straight quotes everywhere, instead of straight
quotes for some of the strings, and curly quotes
for others. Another way to go about it would be
to use the sandwich( function.
{Name + " " + sandwich("(",Yr,")")}
For those that don't know what you are doing as
intimately as I do, the term "html form" in this
case refers to a Panorama form designed to be
used with a SaveAsText command. The text it
generates is html. Formulas are in auto wrap text
objects, so they must be enclosed in {braces}.
I think comparing Yr to a space is actually
better than comparing it to a blank. A space is
the largest of the white space characters, and I
don't think you want to have a pair of
parentheses with nothing but white space between
them.
Dave
More information about the Qna
mailing list