[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
[sqr-users] RE: Processing Negative Number
- Subject: [sqr-users] RE: Processing Negative Number
- From: dewhite@vicr.com
- Date: Tue, 31 Dec 2002 09:39:27 -0500
- List-id: This list is for discussion about the SQR database reporting language from Brio Software. <sqr-users.sqrug.org>
First, I assume that you are using consistent variable names. In the logic
excerpt you have used $Deduction-Amount and #Deduction-Amount, but then you
start mentioning $ded-Amount and #ded-amt, which are not the same variables that
you have in your logic.
Your problems are in the Move statement. You need to move #Deduction-Amount to
$Deduction-Amount, not $Deduction-Amount to $Deduction-Amount. You have
performed the arithmetic commands against the numeric variable, not the
character variable. Also, the hyphen is an illegal character in a numeric edit
mask. As others have pointed out, the negative sign will automatically be
included if the number is negative. I also think you should not use quotes
around the edit mask, although they may be optional, since it looks like the
system accepted them. In the SQR reference for MOVE, only date edit masks are
shown with quotes.
If you wanted to do it in one statement, you could try:
Let $Deduction-Amount = edit((To_Number($Deduction-Amount) / 100) *
-1,'0999999999')
(in this case, you do need the quotes around the edit mask)
HTH,
Denise White
Sr. Software Engineer
Vicor
--__--__--
Message: 1
From: Levy.Mones@sce.com
To: sqr-users@sqrug.org
Date: Sun, 29 Dec 2002 18:51:34 -0800
Subject: [sqr-users] Processing Negative Number
Reply-To: sqr-users@sqrug.org
I have a character number that needs to be changed to negative and back to
character number again. Is there
anybody there who have done this task? Thanks.
Here is my program:
#define Deduction-Length 9
Let #Deduction-Amount = To_Number($Deduction-Amount) / 100
Let #Deduction-Amount = #Deduction-Amount * -1
Move $Deduction-Amount to $Deduction-Amount '-0999999999'
Do Hex-Num($Deduction-Amount,10,$Deduction-Hex)
Result
$ded-Amount =
000000846
#ded-amt after convert to numeric and divide by 100 =
8.460000
#ded-amt after multiplied by - 1 =
-8.460000 <=== I need to convert this back to characte number with the
negative included.
Error on line 143:
(SQR 2101) Bad numeric 'edit' format: -0999999999
_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users