I'm using Crystal X developer edition. I have a report I need to run monthly, the SQL which drives the report is put in a "sql command" through the database expert. What I need to do is have a way to dynamically set the SQL based on paramaters (or create 12 separate reports). Here's the situation:
the simple view of the schema I have to work with (not my design) is:
LocationID
Year
Field1_I1
Field2_I1
Field3_I1
Field4_I1
Field1_I2
Field2_I2
Field3_I2
Field4_I2
...
Field1_I12
Field2_I12
Field3_I12
Field4_I12
Where _Ixx represents the month of the year for which the data is being stored. I need to be able to enter a month I want data for and use only the fields for the Ixx corresponding to the month I need. This goes into a big crosstab table. I do some math on the fields at the SQL level and the output fields are aliased.
I have toyed with getting everything for the year, naming it as valueA_I1, valueB_I1...... and then using a formula on the cross tab to figure out which one to use based on a paramater but not done so yet, in testing directly on my database engine, it can't handle the query so that rules it out.
i'd really like to have some way to dynamically build the entire SQL statement based on the paramaters (range of years, month you want the analysis for, loctions, etc) and then slap that into the command for execution.
Is this possible? or any ideas?
the simple view of the schema I have to work with (not my design) is:
LocationID
Year
Field1_I1
Field2_I1
Field3_I1
Field4_I1
Field1_I2
Field2_I2
Field3_I2
Field4_I2
...
Field1_I12
Field2_I12
Field3_I12
Field4_I12
Where _Ixx represents the month of the year for which the data is being stored. I need to be able to enter a month I want data for and use only the fields for the Ixx corresponding to the month I need. This goes into a big crosstab table. I do some math on the fields at the SQL level and the output fields are aliased.
I have toyed with getting everything for the year, naming it as valueA_I1, valueB_I1...... and then using a formula on the cross tab to figure out which one to use based on a paramater but not done so yet, in testing directly on my database engine, it can't handle the query so that rules it out.
i'd really like to have some way to dynamically build the entire SQL statement based on the paramaters (range of years, month you want the analysis for, loctions, etc) and then slap that into the command for execution.
Is this possible? or any ideas?