Not able to usevariable

Not able to use query variable in actual query for app dynamics and its previewing correct values only but its coming as $undefined in query when i want to use

Can anyone please help