Hi Sajini,

Yes it should be a valid JSON string to get JSON.parse method to work, you
can get more info about JSON.parse from [1][2]

[1] - http://www.w3schools.com/json/json_eval.asp
[2] - http://msdn.microsoft.com/en-us/library/ie/cc836466(v=vs.94).aspx


On Thu, Jun 19, 2014 at 9:04 AM, Sajini De Silva <[email protected]> wrote:

> Hi,
>
> It worked after changing the statement like below.
>
> var queryData = JSON.parse("{\"SQL Statement\" : \"SELECT * FROM
> multiGraphTable2 where hostName = '
> 41304041432.dmz.mgt.platformelb1.wso2.com' limit 10\"}");
>
> Thank you.
> Sajini.
>
>
> On Wed, Jun 18, 2014 at 11:48 PM, Tanya Madurapperuma <[email protected]>
> wrote:
>
>> Hi Sajini,
>>
>> Did you also change the mappings as well?  Because the generated jag file
>> has the mappings as for your initial query. So processing of the data in to
>> the format that flot accepts happens according to that mapping.
>>
>> Thanks,
>> Tanya
>>
>>
>> On Wed, Jun 18, 2014 at 9:48 AM, Sajini De Silva <[email protected]> wrote:
>>
>>> HI Kalpa,
>>>
>>> Yp it works fine with that query, but again there is an error with this
>>> query,
>>>
>>> var queryData = JSON.parse('{"SQL Statement" : "SELECT * FROM
>>> `multiGraphTable2` where `hostName` = 'nameOftheHost' limit 10"}');
>>>
>>> In the backend i get the following error.
>>>
>>> js:
>>> "/monitoring-tool/gadgets/_9c7f9a50-f167-46bc-9e60-2fedd19e6b6f/data-api.jag",
>>> line 6: missing ) after argument list
>>> js:    var queryData = JSON.parse('{"SQL Statement" : "SELECT * FROM
>>> `multiGraphTable2` where `hostName` = 'nameOftheHost"}');
>>> js:
>>> ....................................................................................................................^
>>> [2014-06-18 22:11:16,998] ERROR
>>> {org.jaggeryjs.jaggery.core.manager.WebAppManager} -
>>> org.jaggeryjs.scriptengine.exceptions.ScriptException:
>>> org.mozilla.javascript.EvaluatorException: Compilation produced 1 syntax
>>> errors.
>>> (/monitoring-tool/gadgets/_9c7f9a50-f167-46bc-9e60-2fedd19e6b6f/data-api.jag#1)
>>> org.jaggeryjs.scriptengine.exceptions.ScriptException:
>>> org.jaggeryjs.scriptengine.exceptions.ScriptException:
>>> org.mozilla.javascript.EvaluatorException: Compilation produced 1 syntax
>>> errors.
>>> (/monitoring-tool/gadgets/_9c7f9a50-f167-46bc-9e60-2fedd19e6b6f/data-api.jag#1)
>>>
>>>
>>>
>>> On Wed, Jun 18, 2014 at 10:07 PM, Kalpa Welivitigoda <[email protected]>
>>> wrote:
>>>
>>>> Hi Sajini,
>>>>
>>>> Try,
>>>>
>>>> var queryData = JSON.parse('{"SQL Statement" : "SELECT * FROM
>>>> `multiGraphTable2` limit 10"}');
>>>>
>>>>
>>>> On Wed, Jun 18, 2014 at 9:25 PM, Sajini De Silva <[email protected]>
>>>> wrote:
>>>>
>>>>> Hi Udara,
>>>>>
>>>>> I copied mysql connector lib and this is the error I got.
>>>>>
>>>>> "NetworkError: 500 Internal Server Error -
>>>>> https://localhost:9443/monitoring-tool/gadgets/_9c7f9a50-f167-46bc-9e60-2fedd19e6b6f/data-api.jag
>>>>> "
>>>>>
>>>>> Thank you.
>>>>>
>>>>>
>>>>> On Wed, Jun 18, 2014 at 9:21 PM, Udara Rathnayake <[email protected]>
>>>>> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> Can you copy that error here?
>>>>>> Hope you have relevant connector lib in Jaggery runtime.
>>>>>>
>>>>>>
>>>>>> On Wed, Jun 18, 2014 at 8:57 PM, Sajini De Silva <[email protected]>
>>>>>> wrote:
>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> I created a new gadget using a data source which worked fine. After
>>>>>>> creating the gadget I edited the sql query in data-api.jag like below.
>>>>>>>
>>>>>>> var queryData = JSON.parse('{"SELECT * FROM `multiGraphTable2` limit
>>>>>>> 10"}');
>>>>>>>
>>>>>>> I run this query in mysql database and it gave me the correct
>>>>>>> results, but when I edited the data-api.jag with this query the gadget
>>>>>>> doesn't load and it gives an error in firebug.
>>>>>>>
>>>>>>> Any idea why this is happening?
>>>>>>>
>>>>>>> Thank you,
>>>>>>> Sajini.
>>>>>>>
>>>>>>> --
>>>>>>> Sajini De SIlva
>>>>>>> Software Engineer; WSO2 Inc.; http://wso2.com ,
>>>>>>> Email: [email protected]
>>>>>>> Blog: http://sajinid.blogspot.com/
>>>>>>> Git hub profile: https://github.com/sajinidesilva
>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Dev mailing list
>>>>>>> [email protected]
>>>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> *Udara Rathnayake*
>>>>>> Software Engineer
>>>>>> WSO2 Inc. : http://wso2.com
>>>>>>
>>>>>> Mobile : +94 772207239
>>>>>> Twitter : http://twitter.com/udarakr
>>>>>> Blog    : http://udarakr.blogspot.com
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Sajini De SIlva
>>>>> Software Engineer; WSO2 Inc.; http://wso2.com ,
>>>>> Email: [email protected]
>>>>> Blog: http://sajinid.blogspot.com/
>>>>> Git hub profile: https://github.com/sajinidesilva
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Dev mailing list
>>>>> [email protected]
>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Best Regards,
>>>>
>>>> Kalpa Welivitigoda
>>>> Software Engineer, WSO2 Inc. http://wso2.com
>>>> Email: [email protected]
>>>> Mobile: +94776509215
>>>>
>>>
>>>
>>>
>>> --
>>> Sajini De SIlva
>>> Software Engineer; WSO2 Inc.; http://wso2.com ,
>>> Email: [email protected]
>>> Blog: http://sajinid.blogspot.com/
>>> Git hub profile: https://github.com/sajinidesilva
>>>
>>>
>>> _______________________________________________
>>> Dev mailing list
>>> [email protected]
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>>
>>
>>
>> --
>> Tanya Madurapperuma
>>
>> Software Engineer,
>> WSO2 Inc. : wso2.com
>> Mobile : +94718184439
>> Blog : http://tanyamadurapperuma.blogspot.com
>>
>
>
>
> --
> Sajini De SIlva
> Software Engineer; WSO2 Inc.; http://wso2.com ,
> Email: [email protected]
> Blog: http://sajinid.blogspot.com/
> Git hub profile: https://github.com/sajinidesilva
>
>
> _______________________________________________
> Dev mailing list
> [email protected]
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Regards,

Chatura Dilan Perera
*(Senior Software Engineer** - WSO2 Inc.* * [Mobile])*
www.dilan.me
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to