Page 1 of 1

Posted: Mon Jun 12, 2006 3:04 am
by sb_akarmarkar
Use stage variable to calulate ......................


Thanks,
Anupam

Posted: Mon Jun 12, 2006 3:51 am
by kjaouhari
Thanks all,

but I had to precise that col1 is a column and amount to.
(I have two column)
a sample of my file :
('06' = lines and '08' = total)
------------------------------------------
col1 amount
06 25
06 15
06 05
08 45 (correct amount 25+15+05 = 45)
06 15
08 10 (incorrect total must be 15 )
-------------------------------------------

Thanks ArndW, but I think your solution is just for one column, is it ?

Posted: Mon Jun 12, 2006 3:56 am
by ArndW
You changed your metadata since the first post. Instead of my 2 stage variables, just use your two columns, otherwise the solution is the same.

Posted: Thu Jun 15, 2006 6:59 am
by kjaouhari
I think it's more complicated because in your example you don't check if each total '08' = total lines '06'

I'm creating a routine to check this because I have to check 2 sequence :
The first to know if it's the same article
The second to check total '08' = total lines '06'

I let you know !

Posted: Thu Jun 15, 2006 9:09 am
by kumar_s
You can still use this code with small modificaiton.

Code: Select all

vRunningTotal = 0 --> InitialDeclaration.

vCorrectFlag => If Type = '08' Then if Amount = vRunningTotal Then "Correct" Else False Else ''
vRunningTotal =>IF Type='06' THEN RunningTotal+Value ELSE 0 
You havnt mentioned what to do after checking the total with the amount.
You can intoduce a new column callled CorrectFlag. And assign stage variable vCorrectFlag to it.