Welcome Guest! To enable all features please Login or Register.



Go to last post Go to first unread
#1 Posted : Thursday, October 15, 2020 8:43:07 PM(UTC)

Rank: Member

Groups: Registered
Joined: 5/18/2018(UTC)
Posts: 27

Thanks: 2 times
I would like to have a chart where I can have a variable (call it @choice) selection at the top of the page with an enumerated list Gross = 0 or Net = 1

Then in the advanced sql, it would have (data.gross - (@choice) * data.fees) as the query.

Is there an easy way to pull this off? I suppose I could use the column picker in example 52, but I'm not sure if that works for charts or not.

#2 Posted : Friday, October 16, 2020 6:35:40 AM(UTC)

Rank: Administration

Groups: Administrators
Joined: 12/20/2013(UTC)
Posts: 934

Thanks: 14 times
Was thanked: 158 time(s) in 152 post(s)
Yes we can,
Just add your input restriction, then set an new SQL statement for the element, I just made a try with the 52 sample:
I added the "Quantity Factor" input restriction, then I modify the 'Pre Load Script' of the model to patch the SQL property of the Quantity element (which is normally "SUM([Order Details].Quantity)")
	ReportRestriction restriction = model.Report.GetInputValueByName("Quantity Factor");
	if (restriction != null) 
		var quantity = model.Elements.FirstOrDefault(i => i.DisplayNameEl == "Quantity");
        if (quantity != null) {
            quantity.SQL = string.Format("SUM({0}*[Order Details].Quantity)", restriction.Value1);

Edited by user Friday, October 16, 2020 6:36:25 AM(UTC)  | Reason: Not specified

Users browsing this topic
Forum Jump  
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.