Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Expression problem


Hello:

I have two sliders linked to 2 variables (vCapacity80, vCapacity80Unit) and the sliders are working fine for a line on a line chart.

My chart dimension is a date.

The problem is that I also want to incorporate two date "sliders/calendars" so when a user selects a date range the sliders mentioned above will only change the part of the line between the user selected dates. My date variables are vCapDateMax and vCapDateMin. Currently if dates are entered there is no change to the line chart.. doesn't move.

Here is my test expression that's not working:

//vCapDateMin and vCapDateMax is '' when empty,

//check to see if dates have been entered

if(len(vCapDateMin)=2 or len(vCapDateMax)=2,

sum(Capacity80) + (sum(Capacity80) * vCapacity80) + vCapacity80Unit

,

//dates entered therefore have the slider increase/decrease only happen for the dates in between

// TESTING keep it simple for now and only effect the line where the date > vCapDateMax, once working change

// it to use  >= vCapDateMin and <= vCapDateMax

sum(Capacity80) + (sum({$ <ReferenceDate={'>$(vCapDateMax)'}>}Capacity80) * vCapacity80) + vCapacity80Unit)

I've attached a picture of the chart... it's the red line that uses the working sliders but I can't get the line working when I incoporate the dates

Thanks!

3 Replies
swuehl
MVP
MVP

It's quite hard to tell what my be wrong with just looking at the image and your expression. Could you post a small sample app that demonstrates your issue?

I have also problems understanding the logic you want to apply, but that's probably the case because I don't know your requirements.

If you suspect the sum() with the set analysis to not working as intendend, I would suggest that you isolate the expression (e.g. in a text box):

=sum({$ <ReferenceDate={'>$(vCapDateMax)'}>} Capacity80)

You need to check if the dollar sign expansion of vCapDateMax returns something meaningful, and then if this matches the format of ReferenceDate values.

Not applicable
Author

Thanks swuehl! I've posted a sample of what I'm trying to do... I would expect if dates are entered the charts red line will only change in between the dates using the sliders which change the values.

swuehl
MVP
MVP

Try these as part of your expression:

sum(Capacity80) + (sum({$ <ReferenceDate={'>$(=Date(vCapDateMin))<$(=Date(vCapDateMax))'}>}Capacity80) * vCapacity80) + vCapacity80Unit

the additional date() functions take care of value formatting for the set modifier.