I have a problem with the macro printed here below.
It counts / extracts values from a database, sorts them into tabular cells and calculates the sum for every row. It has 10 search commands, which accordingly should result in a tabular row of 10 cells.
However, the 10th cell is doubled so that there are 11 cells. Nonetheless, the calculated sum is correct.
Any idea?
I have appended a sample of the data, case somebody is willing to have a look on it. IF prompted, search for Code "BN" or "LN", resp.
Thanks,
Fritz
---------------------------------------------------
// subordfrq.vdm Date: 26-03-2004 Time: 16:46:43
// Extracts subordination codes out of *.lfl files
// and calculates frequencies.
BOF()
margin_right(150)
#1=0 // counter for frequency
#2=0 // counter for totals
#80=BufNum // Data file
// Open Result file
#62=File_Check("c:\query\results\subord.txt") // Check if file already open
if(#62 > 0) { Buf_Switch(#62) }
else { fileopen("c:\query\results\subord.txt") }
// Prompt for subordination codes, e.g., "BN"
Get_input(10,"subordination code: ",NOCR)
EOF()
BOL()
RI(10) // insert subordination code in 1th cell
#4=Cur_Line
insindent(8)
#5=CurCol
// Goto Data File
BufSwitch(#80)
//Indicative
#1=sb("5|f11|f|f|f|f|@(10)",0,file_size,noerr+begin+all+COLSET,44,53)
#2+=#1 Call("EXEC")
#1=sb("5|f12|f|f|f|f|@(10)",0,file_size,noerr+begin+all+COLSET,44,53)
#2+=#1 Call("EXEC")
#1=sb("5|f13|f|f|f|f|@(10)",0,file_size,noerr+begin+all+COLSET,44,53)
#2+=#1 Call("EXEC")
#1=sb("5|f14|f|f|f|f|@(10)",0,file_size,noerr+begin+all+COLSET,44,53)
#2+=#1 Call("EXEC")
#1=sb("5|f15|f|f|f|f|@(10)",0,file_size,noerr+begin+all+COLSET,44,53)
#2+=#1 Call("EXEC")
#1=sb("5|f16|f|f|f|f|@(10)",0,file_size,noerr+begin+all+COLSET,44,53)
#2+=#1 Call("EXEC")
//Subjunctive
#1=sb("5|f31|f|f|f|f|@(10)",0,file_size,noerr+begin+all+COLSET,44,53)
#2+=#1 Call("EXEC")
#1=sb("5|f32|f|f|f|f|@(10)",0,file_size,noerr+begin+all+COLSET,44,53)
#2+=#1 Call("EXEC")
#1=sb("5|f34|f|f|f|f|@(10)",0,file_size,noerr+begin+all+COLSET,44,53)
#2+=#1 Call("EXEC")
#1=sb("5|f35|f|f|f|f|@(10)",0,file_size,noerr+begin+all+COLSET,44,53)
#2+=#1 Call("EXEC")
// add sum at end of table row
bufswitch(#62)
GotoLine(#4)
GotoCol(#5)
ins_indent(#5+8)
ins_text("&")
num_ins(#2,FILL+NOCR)
ins_text("\\")
insnewline()
alert()
:EXEC:
Bufswitch(#62) // goto result file
Gotoline(#4)
GotoCol(#5)
instext("&")
numins(#1,left+nocr) // insert frequency of subordination code
ins_indent(#5+8)
#5=CurCol
Bufswitch(#80)
return()
|
|