[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
[sqr-users] Illogical if statement
- Subject: [sqr-users] Illogical if statement
- From: "Stratman, Cathy" <CSTRATMAN@crown-chicago.com>
- Date: Fri, 17 Nov 2006 11:53:30 -0600
- Delivery-date: Fri, 17 Nov 2006 12:56:20 -0500
- List-id: "This list is for discussion about the SQR database reportinglanguage from Hyperion Solutions." <sqr-users.sqrug.org>
Oh great guru's of sqr, I'm tired of beating my head against a wall and
invite you to please help. I have a very simple, very dumb little program
that reads a csv file, does some validation, inserts valid data into
PS_FLAT_RATE_TBL and reports on invalid data.
The first thing that I check is to see if the sum of the employer rate and
the employee rate actually equal the total rate. The if statement I am
using has a mind of it's own and I can't seem to figure out what I may be
doing wrong.
We are on PT 8.22.10, HRMS 8.3sp1, SQL server 2000.
The following code is the reading the input file and validating the coverage
rate. I have included several display statements and what is being
displayed in the log. The numbers look like they are equal to me but the
program doesn't seem to think so. If I insert these three rows via the
panels, everything works fine. Using the program, only the first record is
inserted properly, the other two error out. Suggestions????
Begin-Procedure Read-Input-File
let #Inserts = 0
let #Tot-Recs = 0
let #row = 5
let #err_row = 50
While 1 = 1
Read 1 Into $Input:200
Unstring $Input By ',' Into
$Flat_rate_id
$Effdt
$Emplr_covrg_rate
$Empl_covrg_rate
$Total_covrg
let $Prov_covrg_rate = $Total_covrg
If #end-file = 1
Break
End-If
let $ValidFlag1 = 'Y'
let $ValidFlag = 'Y'
Do Validate-Covrg-Rate
If $ValidFlag1 = 'N'
let $Error_msg = 'Sum of Employer Coverage Rate and Employee Coverage
Rate is not equal to Total Coverage Rate'
Do Report-Error
Else
Do Validate-Date
If $ValidFlag = 'N'
let $Error_msg = 'Date is not in the Right Format'
Do Report-Error
End-If
If $Validflag = 'Y'
let $flag = 'Y'
let #row_found = 0
Do get-fields
if #row_found != 1
let $Error_msg = 'There is no prior data for this FLAT_RATE_ID'
let $flag = 'N'
Do Report-Error
end-if
If $flag = 'Y'
Do Insert-Flat-Rate-Table
End-if
End-If
End-If
End-While
.
.
.
end-procedure
Begin-Procedure Validate-Covrg-Rate
let #num_Emplr_covrg_rate = 0
let #num_Empl_covrg_rate = 0
let #num_Total_covrg = 0
let #total = 0
let #num_Emplr_covrg_rate = to_number($Emplr_covrg_rate)
let #num_Empl_covrg_rate = to_number($Empl_covrg_rate)
let #num_Total_covrg = to_number($Total_covrg)
let #total = #num_Emplr_covrg_rate + #num_Empl_covrg_rate
DISPLAY '$ValidFlag1 COMING IN TO PROCEDURE:' NOLINE
DISPLAY $ValidFlag1
display '#total:' noline
display #total noline
display 'X'
display '#num_Total_covrg:' noline
display #num_Total_covrg noline
display 'X'
if #total = #num_Total_covrg
!do nothing
else
let $ValidFlag1 = 'N'
End-If
DISPLAY '$ValidFlag1 COMING OUT OF PROCEDURE: ' NOLINE
DISPLAY $ValidFlag1
End-Procedure
Log file:
$ValidFlag1 COMING IN TO PROCEDURE:Y
#total:1574.020000X
#num_Total_covrg:1574.020000X
$ValidFlag1 COMING OUT OF PROCEDURE: Y
$ValidFlag1 COMING IN TO PROCEDURE:Y
#total:2422.570000X
#num_Total_covrg:2422.570000X
$ValidFlag1 COMING OUT OF PROCEDURE: N
$ValidFlag1 COMING IN TO PROCEDURE:Y
#total:304.160000X
#num_Total_covrg:304.160000X
$ValidFlag1 COMING OUT OF PROCEDURE: N
_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users