I want to refresh datatable using new data in json format.
I tried using below method but it is giving error mentioned
var myData = table.get('data');
myData.add(json_data);
Error in console log:
invalid 'in' operand config
userTargets = (config && BUBBLETARGETS in config);
Please can someone shed some light if there's any other menthod to refresh yui3 datatable using new data
Thanks in advance.
It sounds like the json data you're passing it isn't an array of objects. Maybe it's an object with the array of objects nested inside somewhere?
At any rate, you can do
table.set('data', json_data.path.to.resultArray);
If you want to append more records to the table, try
table.addRows(json_data.path.to.resultArray);
HTH
It worked fine when I used eval to json_data (which was encoded in Perl from string into Json format)
table.set('data', eval(json_data));
Related
I'm using knex stream interface to stream the data from the table which has lot of records. I want to run some javascript code in each object of the array to modify the object and add extra parameters to the object. So, basically I'm trying to map through the stream and update the objects in the array before pipe it to the response in the api.
I tried something like -
pg('someTable').where(someCondition).pipe(JSONStream.parse()).map((item)=>{
//updating the object
return item
}).pipe(res)
But it's not working. I'm not sure how to do it. Can someone please help me with this?
Thanks in advance :)
I am using fullfilment section on dialogflow on a fairly basic program I have started to show myself I can do a bigger project on dialogflow.
I have an object setup that is a dictionary.
I can make the keys a constant through
const KEYS=Object.keys(overflow);
I am going through the values using
if(KEYS.length>0){
var dictionary = overflow[keys[i]]
if I stringify dictionary using
JSON.stringify(item);
I get:
{"stack":"overflow","stack2":"overflowtoo", "stack3":3}
This leads me to believe I am actually facing a dictionary, hence the name of the variable.
I am accesing a string variable such as stack and unlike stack3
Everything I have read online tells me
dictionary.stack
Should work since
JSON.stringify(item);
Shows me:
{"stack":"overflow","stack2":"overflowtoo","stack3":3}
Whenever I:
Try to add the variable to the response string.
Append it to a string using output+=${item.tipo};
I get an error that the function crashed. I can replace it with the stringify line and it works and it gives me the JSON provided so the issue isnt there
Dictionary values are created as such before being accessed on another function:
dictionary[request.body.responseId]={
"stack":"overflow",
"stack2":"overflowtoo",
"stack3":3 };
Based on the suggestion here I saw that the properties where being accessed properly but their type was undefined. Going over things repeatedly I saw that the properties where defined as list rather than single values.
Dot notation works when they stop being lists.
Thanks for guiding me towards the problem.
I am new to MySQL 5.7. I have a table with a JSON column.
data:{"Game": "Cricket","Player":"Dhoni"}
This is just a sample JSON object but I have plenty of key,value pairs in my column.
I want to replace my JSON completely with new JSON object that I am receiving as a response from some API
e.g.
{"Game": "Hockey","Player":"Kohli","":"",..........}
Please suggest a method for the same.Thanks
To update the JSON completely in MySQL version >= 5.7, simply use the UPDATE query and it will work.
For example:
UPDATE json_table SET json = '{"Game": "Hockey","Player":"Kohli"}' (WHERE CLAUSE)
I am facing an error while parsing my string to json, I have a string that looks like this
{"rxpk":[{"tmst":13885860,"time":"2016-04-13T12:52:17.085935Z","chan":1,"rfch":1,"freq":868.300000,"stat":1,"modu":"LORA","datr":"SF12BW125","codr":"4/5","lsnr":6.0,"rssi":-45,"size":15,"data":"QAMBAQKAPgIFXA2ikKV7"}]}
I am using node-red to create a flow diagram to parse it, I have a function block which makes the following
obj = JSON.parse(msg.payload);
var data = obj.rxpk[0].data;
return data
However, I get the Unexpected token u. What I am doing wrong?
Thanks in advance,
Regards!
EDIT: adding pic, I have something as show in the picture, I have replaced my function that was doing the JSON.parse by the block json.format, thus unexpected token is gone, but still I cannot retrieve my data field from the json string
I have a repeat where the value loops through documents in the current database, these documents contain a database and view name. The repeat then opens the database and view and retrieves data from within them:
var dbOther:NotesDatabase = session.getDatabase(null, doc.getItemValueString("Database"));
if(dbOther != null){
var lookupView:NotesView = dbOther.getView(doc.getItemValueString("ViewName"));
var viewNav:NotesViewNavigator = lookupView.createViewNavFromCategory(key);
}
This works fine on all browsers but if I view the xpage in the Notes Client I get the following error: Exception occurred calling method NotesDatabase.getView(string) null
I have tested that the dbOther variable is set by writing the Server and FilePath properties to a log. I checked that it could see the views by generating a loop using getViews and getAliases, again all view aliases were written to the log without an issue.
I have manually entered the view name in case the value was not being selected from the document correctly but received the same error.
Is there a way I can connect to a view in another database in XPiNC? I have found an XSnippet which allows you to dynamically add view data sources to your page, I think this may get around my problem but wanted to find out if there was an alternative solution before I re-write everything!
Try some of these other ways of getting a handle on a database:
This one uses "" instead of the null parameter to indicate current server:
var dbOther:NotesDatabase = session.getDatabase("", doc.getItemValueString("Database"))
This one uses database.getServer() instead of the null parameter:
var dbOther:NotesDatabase = session.getDatabase(database.getServer(), doc.getItemValueString("Database"))
This one uses sessionAsSigner to get access to the database (instead of using the credentials of the current user):
var dbOther:NotesDatabase = sessionAsSigner.getDatabase(database.getServer(), doc.getItemValueString("Database"))
Are you using a Lotus Notes 8.5.3 client?