No value at variable input

Hi all,

Currently we have a table with (amongst others) the Quantity Delta. Next to the table there are some variable input fields. In these fields, the user can select the Accepted Delta which works for him/her.

To show only the deviations which are bigger than acceptable, the table is filtered by:
Filter Quantity Delta > Accepted Delta

However, in case no input is provided for the accepted delta, the table runs into error. I’d like to keep the input field empty, in order for the users to know what to enter (the text in light grey). As the filter cannot be combined with a case when statement, I couldn’t manage to solve this so far.

Do you have any advice on how to solve this?

Hi,

thanks for reaching out. We are already working on a filter workaround for this. The problem is that once you set the variable input field empty, it returns an empty string ‘’ and not NULL.

Are there just certain thresholds you want to filter on (like 10, 20, 50 etc.) or does the input has to be variable all the time?

I will get back to you as soon as possible. For the moment, you can also add the quantity delta as a dimension and use the little scope above the column to filter on certain thresholds.

Best,
Max

Hi again,

we built a workaround for this. Use the following as your new component filter statement:

<% if(input != “”) { %>
FILTER “column1”.“value” > <%=input%>;
<% } %>

Where

<%=input%>

is the variable set by the variable input field for the Accepted Delta and

“column1”.“value”

your Quantity Delta.

Hope this works for you!

Best,
Max

Hi Max,

Thanks for your help. In the meantime we’ve found another workaround of which I think it works as expected. Instead of using:

  1. Quantity Delta > <%=Delta_Threshold_Q%>

We changed it to:

  1. Quantity Delta > (STR_TO_INT(‘0’||’<%=DeltaThreshold_Q%>’)

Hence, it would return 0 if no threshold value is provided. Otherwise it would return for instance 03 (if 3 is provided), which is doing the same as just a regular 3. In case you see any problems with this solution please let me know.

Thanks again for the help,
Jeroen

Hi Jeroen,

this works for me as well, thanks for the feedback. I tested both solutions in parallel and came back with the following results:

Our workaround

  • Works if you insert in the variable input content like 5, 4.5 and -5
  • Displays entire table if input is empty
  • Returns an error if you insert characters like a,b,c,d, (, ), …
  • No error message if you insert NULL

Your workaround

  • Works if you insert in the variable input content like 5 or 4.5
  • Displays entire table if input is empty
  • Empty table and no error message if negative values like -5 are inserted
  • Empty table and no error message if you insert characters like a,b,c,d, (, ), …
  • No error message if you insert NULL

We would suggest that you use our workaround, so if by mistake a character is inserted, the table throws and error message. Also, it works with negative inputs.

Best,
Max