Page 1 of 2
FMT($999,999,999.99) alignment
Posted: Fri Mar 30, 2012 8:24 am
by Mikhail
I am using an FMT($999,999,999.99) spec on a numeric field. I want the user to start type on the right side of the field, so if they enter 100, the field will show 1.00
How do I do this? Is there a way to make this field right-aligned? Or maybe use another spec?
[BR_forum] FMT($999,999,999.99) alignment
Posted: Fri Mar 30, 2012 12:41 pm
by crosstechsystems
Hi Mikhail
The only spec I know of that is formatted and auto right justifies is using the PIC($ZZ,ZZZ,ZZZ.##) and must be used with a numeric variable. This handles the 100, to show 1.00.
Eddie Singer
Crosstech Systems, Inc.
From: br_forum-bounces@ads.net [mailto:
br_forum-bounces@ads.net]
On Behalf Of Mikhail
Sent: Friday, March 30, 2012 10:25 AM
To: br_forum@ads.net
Subject: [BR_forum] FMT($999,999,999.99) alignment
I am using an FMT($999,999,999.99) spec on a numeric field. I want the user to start type on the right side of the field, so if they enter 100, the field will show 1.00
How do I do this? Is there a way to make this field right-aligned? Or maybe use another spec?
Posted: Fri Mar 30, 2012 12:50 pm
by gordon
Posted: Fri Mar 30, 2012 1:06 pm
by GomezL
I never found a solution that I like, so I ended up using CR 12,AE for my input statement.
As the user types, the cursor starts at the right, but no automatic formatting happens as they type.
The AE attribute causes a "Round Trip", and I process the string, and format it for the user, so as soon as they leave the field it is formatted the correct way.
[BR_forum] FMT($999,999,999.99) alignment
Posted: Fri Mar 30, 2012 1:09 pm
by Mikhail
Gordon, I need the field to already contain the $ sign, commas and the decimal point, so N 12.2 wouldn’t work for that
From: br_forum-bounces@ads.net [mailto:
br_forum-bounces@ads.net]
On Behalf Of gordon
Sent: Friday, March 30, 2012 9:50 PM
To: br_forum@ads.net
Subject: Re: [BR_forum] FMT($999,999,999.99) alignment
You can use N 12.2 with DECIMAL ASSUMED.
See
http://brwiki.ads.net/index.php?title=BRConfig.Sys#DECIMAL
[BR_forum] FMT($999,999,999.99) alignment
Posted: Fri Mar 30, 2012 1:11 pm
by crosstechsystems
Hi All
I agree with all the options you gave. The only issue I see is that he wanted the $ symbol leading.
Eddie Singer
From: br_forum-bounces@ads.net [mailto:
br_forum-bounces@ads.net]
On Behalf Of GomezL
Sent: Friday, March 30, 2012 3:06 PM
To: br_forum@ads.net
Subject: Re: [BR_forum] FMT($999,999,999.99) alignment
I never found a solution that I like, so I ended up using CR 12,AE for my input statement.
As the user types, the cursor starts at the right, but no automatic formatting happens as they type.
The AE attribute causes a "Round Trip", and I process the string, and format it for the user, so as soon as they leave the field it is formatted the correct way.
Posted: Fri Mar 30, 2012 4:10 pm
by John
i think the CR 12 is what we will end up doing too. N 12.2 would work EXCEPT that we must move these numbers into string variables.
-john
Posted: Fri Mar 30, 2012 9:33 pm
by gordon
Correct me if I'm wrong about this...
Normal PIC processing e.g. PIC($$,$$$.00) would do everything desired if it honored DECIMAL ASSUMED.
Is that correct?
Posted: Sat Mar 31, 2012 7:41 am
by Mikhail
PIC is not right aligned. I will have to use logic similar to what Luis described. Luis can you provide a small example of using CR 12, AE like you described
[BR_forum] FMT($999,999,999.99) alignment
Posted: Sat Mar 31, 2012 8:22 am
by gomezl at msn.com
Small example?
let me see if I can cobble something.
The basic idea convert number to formatted string
Input char value
Strip symbols and convert to number
We assume that if you don't type a ". " that you entered cents
Loop back to format and input .
Sent from my iPhone
On Mar 31, 2012, at 9:41 AM, "Mikhail" <
brforumlist@ads.net (
brforumlist@ads.net)> wrote:
Posted: Sat Mar 31, 2012 9:29 am
by gordon
PIC is right aligned if the receiving variable is numeric.
It then repaints the value right aligned upon field exit.
Try PIC($$,$$$,$$$.00) with a numeric receiving variable.
Then please tell me what would be deficient if we honored DECIMAL ASSUMED.
[BR_forum] FMT($999,999,999.99) alignment
Posted: Sat Mar 31, 2012 9:34 am
by Mikhail
We need all the variables to be strings.
Posted: Sat Mar 31, 2012 1:39 pm
by Gabriel
In an email, Mikhail wrote: "We need all the variables to be strings."
Why can't you just do the input with a numeric variable and then put the value in a string right afterwords?
Gabriel
Posted: Tue Apr 03, 2012 3:31 pm
by John
Using numeric variables is not an option. It is a centralized function that processes all screens with the same rinput statement. It would not be possible to guess every combination of string-number-string/string-string-number-number-string/etc that every screen in the software uses. We're enhancing Screen Ace to use BR! instead of VB6. An array of strings are passed in and are passed back - then numbers are take out with the val command by the calling program.
-john
Posted: Wed Apr 04, 2012 9:39 am
by gordon
I have attached a program that demonstrates using #PIC for numeric input into string variables. It only works for GRID entry, so I don't know if this meets your needs.