FMT($999,999,999.99) alignment

General development discussion.

Moderators: Susan Smith, admin, Gabriel

Mikhail
Posts: 87
Joined: Tue Jul 07, 2009 10:26 am
Location: Ukraine

FMT($999,999,999.99) alignment

Post 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?
crosstechsystems
Posts: 4
Joined: Tue Jun 09, 2009 11:24 am

[BR_forum] FMT($999,999,999.99) alignment

Post 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?
gordon
Posts: 358
Joined: Fri Apr 24, 2009 6:02 pm

Post by gordon »

You can use N 12.2 with DECIMAL ASSUMED.

See http://brwiki.ads.net/index.php?title=B ... ys#DECIMAL
GomezL
Posts: 258
Joined: Wed Apr 29, 2009 5:51 am
Contact:

Post 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.
Mikhail
Posts: 87
Joined: Tue Jul 07, 2009 10:26 am
Location: Ukraine

[BR_forum] FMT($999,999,999.99) alignment

Post 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
crosstechsystems
Posts: 4
Joined: Tue Jun 09, 2009 11:24 am

[BR_forum] FMT($999,999,999.99) alignment

Post 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.
John
Posts: 555
Joined: Sun Apr 26, 2009 8:27 am

Post 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
gordon
Posts: 358
Joined: Fri Apr 24, 2009 6:02 pm

Post 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?
Mikhail
Posts: 87
Joined: Tue Jul 07, 2009 10:26 am
Location: Ukraine

Post 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
gomezl at msn.com

[BR_forum] FMT($999,999,999.99) alignment

Post 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:


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 mailing list
BR_forum@ads.net (BR_forum@ads.net)
http://box475.bluehost.com/mailman/listinfo/br_forum_ads.net
gordon
Posts: 358
Joined: Fri Apr 24, 2009 6:02 pm

Post 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.
Mikhail
Posts: 87
Joined: Tue Jul 07, 2009 10:26 am
Location: Ukraine

[BR_forum] FMT($999,999,999.99) alignment

Post by Mikhail »

We need all the variables to be strings.
Gabriel
Posts: 412
Joined: Sun Aug 10, 2008 7:37 am
Location: Arlington, TX
Contact:

Post 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
John
Posts: 555
Joined: Sun Apr 26, 2009 8:27 am

Post 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
gordon
Posts: 358
Joined: Fri Apr 24, 2009 6:02 pm

Post 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.
Attachments
grid3.wb
#PIC Example
(3.37 KiB) Downloaded 478 times
Post Reply