cancel
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

PriscilaSantos
Newcomer

Hello,

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:

PriscilaSantos_0-1718706833865.png

The query I have for Conversation App logs is:

fetch logs
| filter service.name == "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?

Thanks

4 REPLIES 4

PedroSantos
Advisor

Hello!
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!

To make an error is human. To spread the error across all servers in an automated way is DevOps.

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?

To make an error is human. To spread the error across all servers in an automated way is DevOps.

My query has similar requirements

timeseries value=avg(cloud.aws.lambda.duration),
  by: { dt.entity.custom_device }
| lookup [fetch dt.entity.custom_device ],
  lookupField:id,
  sourceField:dt.entity.custom_device,
  fields:{
    entity.name,
    managementZones,
    customProperties,
    tags
  }
| filter
  if($Suites != "", in(tags, $Suites))

  

I still end up getting the error Define a value in the referenced variables: $Suites". This is if there is nothing selected in the dropdown. If i select at least 1 value in the dropdown, the query works. 

Featured Posts