Skip to main content
Question

Could you please help me to find out how I can check for empty variable input to prevent the component (specifically - OLAT table) from running into an error?

  • July 23, 2021
  • 2 replies
  • 20 views

Forum|alt.badge.img+4

I have the following case:

  1. A Variable Input component is configured to write to a variable called "Target"
  2. AN OLAP table with one of the KPIs calculating the difference in days between the actual throughput time and the "Target" input
  3. The formula I am using is: TRIMMED_MEAN(CALC_THROUGHPUT(CASE_START TO CASE_END, REMAP_TIMESTAMPS(""."", DAYS)), 5, 5) - <%=Target%>)
  4. However, the table output will fail if the user wipes out the value from the Variable Input component (which for sure can be the case).

 

 

I've tried with different operators to handle CASE WHEN the variable is empty (blank): IS NULL, != '', !="" - it's not working (e.g.

 

CASE WHEN <%=Target%> IS NOT NULL

THEN

(TRIMMED_MEAN(CALC_THROUGHPUT(CASE_START TO CASE_END, REMAP_TIMESTAMPS("GTO_Application_Workflow_csv"."CHANGE DATE", DAYS)), 5, 5)

- <%=Target%>)

ELSE NULL

END)

 

The only solution I was able to found in documentations deals with the same issue for filters, but not for the formulas: <% if(Target != "") { %> FILTER ""."" IN (<%=Target%>); <% } %>

 

How can I make PQL digest the fact that my variable is just empty?)

Thanks a lot in advance.

 

2 replies

Forum|alt.badge.img

Hello Mariana.

Yes, you can use part of the solution you already have for filters:

<% if(variable_name != "") { %>

COUNT_TABLE("EKPO") <% } %>

 

If your variable is empty, you will see errors when typing the formula, but it works ;-)

 

21


Forum|alt.badge.img+4

Hello Mariana.

Yes, you can use part of the solution you already have for filters:

<% if(variable_name != "") { %>

COUNT_TABLE("EKPO") <% } %>

 

If your variable is empty, you will see errors when typing the formula, but it works ;-)

 

21

@daniel.galiz thank you very much for your help, it worked 😊