Aqeel Haider
Aqeel Haider

Reputation: 633

How can we use iReport parameter in sql query column

In an iReport I'm using parameter in SQL query, but the parameter field is not showing in the data set. I have a fee structure table which 12 months columns for amount, I'm trying to get the desire month by passing the parameter as column, but the parameter column is not showing in the data field. Here is my query, I'm passing FeeStructure.$P!{Months} as a parameter column.

SELECT 
    StudentInformation.ID, ClassS.Class, Parents.Parents, 
    FeeCatagory.FeeCatagory, FeeStructure.$P!{Months}
FROM 
    StudentInformation 
INNER JOIN 
    ClassS ON StudentInformation.[C/Class] = ClassS.Id 
INNER JOIN 
    Parents ON StudentInformation.ParentID = Parents.ID 
INNER JOIN 
    FeeStructure ON ClassS.Id = FeeStructure.ClassID AND Parents.ID = FeeStructure.ParentID 
INNER JOIN  
    FeeCatagory ON FeeStructure.CatagoryID = FeeCatagory.ID 
WHERE 
    Class = $P{ClassID} 
    AND Parents = $P{Parent} 
    AND StudentInformation.ID = $P{StudentID} 
ORDER BY 
    FeeCatagory

Upvotes: 0

Views: 534

Answers (1)

Mani Deep
Mani Deep

Reputation: 1356

plz check with this.

$P!{Months} for this parameter give any month name as default value

and also use aliasing

  FeeStructure.$P!{Months} as month

instead of

  FeeStructure.$P!{Months}

Upvotes: 2

Related Questions