Skip to main content
New

I want an IF operator in Charts.

Related products:Charts
  • October 30, 2025
  • 8 replies
  • 96 views

Shun Takase
MVP

When performing calculations in Charts, it is often necessary to implement conditional branching.
 For example, depending on the value of the reaction temperature, you may want to branch according to whether the plant is operating or stopped, and change the calculation formulas accordingly.
 If this can be achieved, many of the calculations that were originally managed in Excel can be executed on CDF.

8 replies

Jørgen Lund
Seasoned Practitioner
Forum|alt.badge.img
  • Product Manager
  • 138 replies
  • October 31, 2025

Hi ​@Shun Takase!

Thank you for suggesting this product idea. We will follow the traction this idea gets in the community. You can expect updates on this post if we decide to include this in our future roadmap, or if we require more information.


Shun Takase
MVP
Forum|alt.badge.img
  • Author
  • MVP
  • 19 replies
  • November 4, 2025

Hi, ​@Jørgen Lund !

Thank you for your reply.
 I hope there will be progress on this feature in the future.


APSHANKAR Sagar
Committed
  • Committed
  • 30 replies
  • November 4, 2025

Another option to achieve this same behavior might be to implement IFs and Logic ops in Synthetic Time Series and have a way to reference a synthetic time series calculation in Charts. I to very often need to make calculations after verfying “stable state”; i.e. Machine in operation for 2 hours & | SP - PV | < 10 degrees & ... 


Everton Colling
Seasoned Practitioner
Forum|alt.badge.img
  • Seasoned Practitioner
  • 224 replies
  • November 4, 2025

Hi ​@Shun Takase!

The functionality you are looking for is already available using a block called “Logical Check”.

This is the block description: “Perform a logical check between time series/constants and returns the assigned time series/constants when the condition holds true or false. The logical check is performed following the format: Value 1 {operator} Value 2, where the operator can be Equality (==), Inequality (!=), Greater than (>), Greater or equal than (>=), Smaller than (<) or Smaller or equal than (<=).”

Here’s a simple example.

 


Shun Takase
MVP
Forum|alt.badge.img
  • Author
  • MVP
  • 19 replies
  • November 5, 2025

Hi , ​@APSHANKAR Sagar !

Thank you for your reply.
Is my understanding correct that a Synthetic Time Series is something calculated outside of Charts, 
then registered in the CDF as a time series and used from there?
Apologies if I’m off the mark.
 


Shun Takase
MVP
Forum|alt.badge.img
  • Author
  • MVP
  • 19 replies
  • November 5, 2025

Hi , ​@Everton Colling  !
Thank you for your reply.


Thank you also for sharing such a great idea, and for the clear example.
I wasn’t aware of this operator, but it looks like it could be used in many ways similar to an IF operator.
I’ll go ahead and share this internally and start using it right away.


APSHANKAR Sagar
Committed
  • Committed
  • 30 replies
  • November 5, 2025

Hi , ​@APSHANKAR Sagar !

Thank you for your reply.
Is my understanding correct that a Synthetic Time Series is something calculated outside of Charts, 
then registered in the CDF as a time series and used from there?
Apologies if I’m off the mark.
 

Hi Shun, AFAIK, an STS is not ‘registered’ in CDF, but calculated on the fly. It helps you make calculations using multiple time series. Every time you want to see it, you call it with your expression. Here is an example.

 

variables = {"SP": set_point_ts_ext, "PV": process_val_ts_ext}

expression_pv = ["PV"]
if limit_type == 'Percentage':
expression_sp = [f"SP * {1 - lcl/100}" , f"SP * {1 + ucl/100}" ]
elif limit_type == 'Relative':
expression_sp = [f"SP - {lcl}" , f"SP + {ucl}"]
else:
logger.error(f"Unknown limit type {limit_type}.")
return

pv_df = client.time_series.data.synthetic.query(expressions=expression_pv, start=start_time, end='now',
granularity = '1m', aggregate = 'average',
variables=variables,
).to_pandas()

 


Shun Takase
MVP
Forum|alt.badge.img
  • Author
  • MVP
  • 19 replies
  • November 5, 2025

Hi , ​@APSHANKAR Sagar  !
Thank you for your reply.


I see — I understand the idea now, and I really appreciate the clear example you provided.
Since this involves using the API, it seems like some technical skill is required to handle it properly,
but it looks like this approach can cover most of the processing I want to achieve!
I’ll definitely give it a try.