faraz.ahmed
Posts: 1
Joined: Wed May 30, 2018 3:30 pm

How To Set Context Variable and How to Show it in Event Window

Wed May 30, 2018 3:35 pm

Hi,

We are facing problem regarding setting context variable and showing it in event window.
In our event rule script expression we have used below method to set the context variable

context.setVariable("Distance", faulty_cones);

faulty_cones variable is string type.
Here is screen shoot.

https://gm1.ggpht.com/OrseSPnSXROogD3PEhz6PtxU6hQyX5Ab-YHNaSfi9hv_Rh0wgpF1N9gyXQgyuTsucj60pKzDZ4PrbK1fI-0NnsF6aSgwcmfJIV9XDv-HqzUwgNmBC3wskslvkzXQ2alC5ngmRsgPHJ7ZZ7A_K3YC682Q3U7E3WXQYfpbd5w-3AOtjgXKXCGWv1L3joWTHqJEI8um3b8jw4JG1f-B4BXnSKjcIjO8MZH84g9F8W4VRfAM9W6ASlOT8qMT9VzXUBYnzHi_xSLq9tar6D2axdnK1mDtdBUO_eacESsmCyyrq-1VFkSHkyn_LSIFo3UCK2nACIQaJsLObhwFZJTN0PXdLSec7H5hHcNp9W_CFl7yhXKIyjROtMER9a4HZjILnUCXntEIho0J76WtiGLqONGyKBs16QZmeD6kYzf1ZTevSbNP6CEA0lMZpCVJO4Uk68JZ9Bw3L6LvG_G9EwVT3s3b6DMte4NRbWGfC4L8Q1Lmj0GtqfI6QCGNrgYwrZONBhNB0Y58jMiizgd6rYB_HUWhOb8-OgNmYNSMOn5WYkhe5EovDXdp4CeWePq-c8DkvIH285vnrONAXFAbp968K8tx2xu5l6hQLlUohqeaWV11qFXgwwKmtQi-7MbmPnHr2bfxpyaVYxNNl2sWhwC0xmXJsTOR-hvUBF_uAjnjUv5ZfnTJRnKJFuLeSrpo5PWty8A=w1070-h602-l75-ft

Now we are trying to show that "Distance" variable in event rule notification area as shown in below screen shoot

https://gm1.ggpht.com/9J_D91vZrr1DFYuoALTNht791ecTGdtKa-eYnbr5ZM4VR6eHTsmt9iVlvaWIbyvz8Rb1ne2yVattS2YDuEHplVou2nBXBAZhAmijM6z_DNeE6nsQYAikv-gCRemPG5l6O2rgq3MHgtU4ebG-G64OSqNVQoVV66FvmPhlrFvPMW9jmS6sWyDfCWl7sFZCMPGrPyFSVkXFWHDYzHbb06RO79YRrOFzkSnGPjjlC8RxAQb89c1Ksm9kos7seWlB9dq20jjqsNHoqiLYanR288o0ZEBmISjlygRiZnuBs3SYAnsmnk5XQmEW1FrCrydK84baeCDVOp0VZ0FLTgLaa1N3cnHY6nVwWLc1pH9E67ZOLhKkTY_stUDCvNrrHopMw0i-dOztD8NlFFZnXk4czWdEhmJbrYg8R5bQY0SLFzx_MCJIImg781BkJjMJ__VVPwhif_MVI1E4GUfrOhMztOAAN9becw8ae3kEqQ0RI9e986ag0bOSYwHPY1bAy_U1G-E-piRr5vt3jZoA5ibyDNtYl01tpgtDwYIhhIEb4ZVi0APspxSJLh5BWffi3NC9sSnwcK88j5-JGJM2RJtS0GrTMuYR0fkx96vx_C1WTqouvozleADZMRxnpesBRhlbACndhxmcZeRoXzFmERuEqQ2w4_lmoGc2vgAR6cGEzfiGyxmQQZMa6SBXcJZq0AhF=w1070-h602-l75-ft

But its not showing any value in event window its showing empty string.
we have try to log it in script to check either its set or not by using below function

log(context.getState("Distance"));

But its returns error

Can you please help us regarding this?
Our goal is to set some string value in context variable and show that variable in event window/panel



Thanks,
Faraz

Return to “GpsGate for Developers”