General information
Category:
Coding, syntax & commands
In this line for a SQL-Statement:
SELECT report_1 AS report_1, ;
reportnames.descript + "total" AS descript, ;
IIF(I_L = "I",(Total,Total)*-1) AS Total, ;
printorder AS printorder, ;
groupcode AS groupcode, ;
"X" AS I_L ;
FROM Report1 ;
GROUP BY Groupcode ;
ORDER BY I_L ;
INTO CURSOR SummaryTable
The line:
IIF(I_L = "I",Amount,Amount*-1) AS Amount
I am trying to use it to do a calculation into a cursor. However, I upon looking at it, it will only do the income fields and not expense fields. I tried setting a filter, but it did not work.
The tables look like:
DESCRIPTION CODE AMOUNT groupcode I_L
DVD INCOME 410 50000 10 I
DVD LOSS 510 10000 10 L
VHS INCOME 420 50000 20 I
VHS LOSS 520 60000 20 L
ADMINISTRATIVE 610 40000 60 I
SALES 710 30000 60 I
and I need the calculations into a summary table to look like:
DESCRIPTION CODE AMOUNT groupcode I_L
DVD TOTAL 40000 10 X
VHS TOTAL -10000 20 X
OFFICE TOTAL 70000 60 X
but my calculations are always off. not to mention my description. Any tips?
Thanks
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only