Input Variable in Celonis (PQL)

Hello to Everyone,

I have a question related to PQL,

In one of the analysis, I am using the Input variable where user can enter a number which written to assigned variable.

However, I want to do a check here,

When the user doesn’t provides any input or deletes the already assigned value, the variable value becomes NULL

How can I write a PQL query to check if the variable’s value is NULL, because when it will be NULL, I want to assign a hard-coded value to it.

Like:

CASE WHEN ISNULL(<%= test_variable %>) = 1 THEN 100 ELSE <%= test_variable %> END

This is the logic I want to use however, I do not know how to construct this query,

Any help or ideas will highly be appreciated. Thank You

Best Regards,
Khushboo

Hi Khushboo, I suppose you can create a KPI doing this check and then use the KPI in your query rather than the variable itself.

Hi soppeneer,

Thank You for your prompt response.
I have attached an image where I tried to show what my idea to is achieve, in the image you see some events have time assigned, and some are empty, When the time is assigned the query should be using that, and when it is not assigned then the query should use the hard-coded value that I want to assign different numbers for different events.

Like when event1variable is not null then use the value of the event1variable else use 4
Like when event2variable is not null then use the value of the event2variable else use 7
Like when event3variable is not null then use the value of the event3variable else use 1
.
.
.
Like when eventnvariable is not null then use the value of the eventnvariable else use 9

However, attempting to do this in KPI throws an error ‘Constant not allowed’

I do not know how to write this in KPI and not get this error.

Any advice or idea is very much appreciated and welcome :slight_smile:

Thank You once again

Best Regards,
Khushboo

image

Hi Khushboo, the problem may be in using the IS NOT NULL for an integer. What if you create one KPI per variable, e.g. for Create PR:

CASE WHEN <%=varCreatePR%> > 0 THEN <%=varCreatePR%> ELSE 4 END

The KPI you can then use for further queries rather than the variable itself.

Thank You so much for your help :slight_smile: