PeteWalburn
Programmer
Hi,
I need to create a report that takes a parameter specifying which type of report it is.
It is a TRANSACTION report, but there are different types of these reports (Issue, Receipt, Returns, etc). Each Transaction type will have a different SQL statement albeit returning columns of the same names.
Is it possible to build up the SQL statments in code depending on the passed in parameter?
I want something like:
Select Case Type
Case "ISS"
SelectClause = "LINECOST AS TRANSVAL,REFWO AS TRANSWO"
FromClause = Schema & ".MATUSETRANS"
WhereClause = "ORGID='" & mroOrg & "' AND "
WhereClause = WhereClause & SITEID='" & mroSite & "'"
OrderByClause = "TRANSWO"
Case "REC"
SelectClause = "ACTUALCOST AS TRANSVAL,'' AS TRANSWO"
FromClause = Schema & ".MATRECTRANS"
WhereClause = "ORGID='" & mroOrg & "' AND "
WhereClause = WhereClause & "SITEID='" & mroSite & "'"
OrderClause = "TRANSVAL"
End Select
There is a lot more to the SQL than this, but this is the general idea.
Is it possible? How?
Pete
I need to create a report that takes a parameter specifying which type of report it is.
It is a TRANSACTION report, but there are different types of these reports (Issue, Receipt, Returns, etc). Each Transaction type will have a different SQL statement albeit returning columns of the same names.
Is it possible to build up the SQL statments in code depending on the passed in parameter?
I want something like:
Select Case Type
Case "ISS"
SelectClause = "LINECOST AS TRANSVAL,REFWO AS TRANSWO"
FromClause = Schema & ".MATUSETRANS"
WhereClause = "ORGID='" & mroOrg & "' AND "
WhereClause = WhereClause & SITEID='" & mroSite & "'"
OrderByClause = "TRANSWO"
Case "REC"
SelectClause = "ACTUALCOST AS TRANSVAL,'' AS TRANSWO"
FromClause = Schema & ".MATRECTRANS"
WhereClause = "ORGID='" & mroOrg & "' AND "
WhereClause = WhereClause & "SITEID='" & mroSite & "'"
OrderClause = "TRANSVAL"
End Select
There is a lot more to the SQL than this, but this is the general idea.
Is it possible? How?
Pete