Puzzled - Put a single percent symbol into a label? Is there a better way?

Author: n.fawcett@ssp-uk.com (NeilFawcett)

This seemed to be the only way I could get a "%" symbol into a label, such that it would read "Discount %age":-

            $1 = "%"
            $labelproperties("prompt.ENTITY") ="text=Discount %%$1%%%%%$1%%%age"
 

Is there a better (or less odd) way?

5 Comments

  1. Try it with "%% "; it looks like the lable "eats" one % sign.

    Success, Uli


    Author: ulrich-merkel (ulrichmerkel@web.de)
  2. This one works:  $labelproperties("prompt.ENTITY") ="text=Discount %% age"

    Got my inspiration from the chapter "Substitution in String Values" of the Uniface help pages.


    Author: Arjen van Vliet (arjen.van.vliet@uniface.com)
  3. Hi Arjen,

    but it just reads:

    • A space following two percent signs is automatically removed by the
    Proc compiler; the two percent signs appear unchanged.

    So "%% " becomes "%%", and the label sitll eats one "%".

    Success, Uli


    Author: ulrich-merkel (ulrichmerkel@web.de)
  4. Hi Uli,

    Correct, in fact I'm suggesting the exact same solution as you already did. I tried it in a testform and it works.

    The info in the help section declares that a space after a double percent sign gets 'eaten', but indeed the 'eating' of the second percent sign in the label is not declared at all.

    As often our inspiration is in the help files and the last steps are done tweaking a testform, as Uniface ways are sometimes mysterious ;-)

    The exact location of the help section is Programming in Uniface -> Proc language -> Data Handling in Proc -> Substitution in String Values. Or search for the word 'violets'.

    Cheers!

    Arjen


    Author: Arjen van Vliet (arjen.van.vliet@uniface.com)
  5. Thanks guys!

     

    What an incredibly voodoo solution!


    Author: NeilFawcett (n.fawcett@ssp-uk.com)