Showing results for 
Show  only  | Search instead for 
Did you mean: 

Error "Define a value in the referenced variables" when using Text variables that by default are empty



I am creating a new dashboard that has some text variables that I use in other query grail tiles to filter logs and spans.

However, if I don't set a value in those variables I get the error everytime I open the dashboard:

"Define a value in the referenced variables: user_id"

I don't want to impose that the text variable is filled. If I then enter a space and delete it in the text variable, the dashboard then works and the error disappears.

Here is a screenshot of the error:


The query I have for Conversation App logs is:

fetch logs
| filter == "conversation"
| filter contains(user_id, $user_id)
| filter contains(content, $interaction_id )
| filter contains(content, $search_in_logs )
| sort timestamp asc
| fields timestamp, content, extra_fields, user_id, pid


Is there a way to fix this?



Frequent Guest

I have very limited experience but looking over your problem I do have a suggestion you can try.
I think the problem might be in your filter lines.
You have:

| filter contains(user_id, $user_id)

I suggest trying:
| if ($user_id != "", filter contains(user_id, $user_id))

The idea is checking if $user_id is not empty. If there's something in there, it applies the contain filter. If not, it skips the filter entirely. The dashboard shouldn't complain then.
If it works, do the same for $interaction_id and $search_in_logs

Let me know if it works!

Unfortunately, that doesn't work, it gives an error with the query, but thanks for the suggestion, it would make sense to work

Can you show me the updated query you did (with my suggestion) and the error it gave?
Sometimes, progress is just finding a different error xP Or is it the same error?

Featured Posts