Now everything up to Model is not a problem...the problem fields are:
Model Vin Component Incident
The problem with them is that they each come from the same table and field. In the report I have to write a formula such as:
If {Userfield.Description} = 'Model' then {Userfield.UserfieldValue} If {Userfield.Description} = 'Vin' then {Userfield.UserfieldValue} If {Userfield.Description} = 'Component' then {Userfield.UserfieldValue} and so on...
Now this all works perfectly until the end user wants to select a specific Model type or some specific Incident or any combination of all of the above. Simply writing this into the Select statement would fail because each of the above columns is pulled from the same field, so it would simply leave the other columns blank and fill one in.
Example data for one record in Userfield table: Model: Ford Vin: (blank) Component: Cab Incident: Fire
Now I want to run the report with the Model parameter to search for Ford and Incident to be Fire...but the others, Vin, Component to search for all values. If I write the select parameter normally, then it will ONLY return Incidents which are Fire...it basically overwrites the other parameter that searches for Ford. On top of that, each of the other columns will come back blank since the SELECT will only take values from the field which are Fire. The Matter Number, Matter Name, and other fields still show, but then anything from the UserfieldValue field is blank except for fire.
Anyone know possible fixes for this? I can write suppression formulas which would be a whole bunch of If, Then, Else statements to cover every possibility, but we're talking 16 formulas to cover every scenario...more if in the future they want more fields to be searched on. Any ideas?
Joined: 14 Nov 2007
Online Status: Offline
Posts: 377
Posted: 08 May 2008 at 9:14am
Your best option is probably to get ahead of the problem by doing your pseudo-crosstab in the SQL of your data source. Create a SQL Command that looks like:
SELECT "Matter Number","Matter Name","Litigation Stage", MAX(CASE Description WHEN 'Model' THEN UserfieldValue ELSE '' END) AS Model, MAX(CASE Description WHEN 'Vin' THEN UserfieldValue ELSE '' END) AS Vin, MAX(CASE Description WHEN 'Component' THEN UserfieldValue ELSE '' END) AS Component, MAX(CASE Description WHEN 'Incident' THEN UserfieldValue ELSE '' END) AS Incident FROM Userfield GROUP BY "Matter Number","Matter Name","Litigation Stage"
This will yield one line for each combination of number, name, and stage. Hopefully, you don't have to worry about, say, multiple components for a given combination?
Now you have a much simpler situation, because you just do your parameters and selection criteria against the denormalized data set.
Joined: 06 May 2008
Online Status: Offline
Posts: 3
Posted: 08 May 2008 at 9:17am
Ok, I was just actually re-writing my query one of two ways and trying to figure out the CASE syntax, that helps...thanks! Here's the other way that I've come up with but have yet to finalize. Which would be more efficient in your opinion?
SELECT Matter.MatterNumber, Matter.MatterName, Matter.MatterStatus_CD, Matter.TargetDate, Matter.ProductService_CD, Matter.Matter_CD, MatterPlayer.Role_CD, MatterPlayer.EndDate, Entity.Name, a.row_id, a.description, a.userfieldvalue as Component, b.userfieldvalue as Model, c.userfieldvalue as TreadAct, d.UserfieldValue as BuildDate, e.UserfieldValue as Vin, f.userfieldValue as Incident FROM ecounsel.BGGT.MatterPlayer MatterPlayer, ecounsel.BGGT.Matter Matter, ecounsel.BGGT.Entity Entity, ecounsel.BGGT.Userfield as a, ecounsel.BGGT.Userfield as b, ecounsel.BGGT.Userfield as c, ecounsel.BGGT.Userfield as d, ecounsel.BGGT.Userfield as e, ecounsel.BGGT.Userfield as f WHERE MatterPlayer.MatterNumber_ID=Matter.MatterNumber_ID AND MatterPlayer.Entity_EID=Entity.Entity_EID AND Matter.MatterNumber_ID=a.Row_ID AND Matter.Matter_CD='Products Liability' AND a.description = 'Component' AND b.description = 'Model' AND c.description like '%Tread Act%' AND d.description = 'Build Date'AND e.description = 'Vin' AND f.description = 'Incident Type:' AND a.row_id = b.row_id AND a.row_id = c.row_id AND a.row_id = d.row_id AND a.row_id = e.row_id AND a.row_id = f.row_id
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum