Forum Discussion
JohnBarulich1
7 years agoQrew Cadet
Dan:
Thanks a bunch, this helped me a ton with how to start and what I need to learn. A few comments/questions about the syntax/logic. Feel free to let me know anything about my thought process here:
1. I understand we need to create an anonymous function for the .each() call so that we can loop through every record and retrieve its attributes
2. I understand what get() conceptually should do. The dbidTable needs to be referenced on every iteration of the each() loop
3. The .then() is a promise to be fulfilled if the get() call is successful. However, what value is stored into 'xml' from get() if it's successful. And WHY do we need to pass 'xml' to our selection along with record? Why are double quotes allowed, when the literature I have read for this requires single quotes?
4. Can you briefly explain the necessity for the 'this' keyword in the selection. I have used it plenty, but maybe there are subtleties I don't quite understand in this statement.
Thanks again, I have learned quite a bit so far.
Thanks a bunch, this helped me a ton with how to start and what I need to learn. A few comments/questions about the syntax/logic. Feel free to let me know anything about my thought process here:
1. I understand we need to create an anonymous function for the .each() call so that we can loop through every record and retrieve its attributes
2. I understand what get() conceptually should do. The dbidTable needs to be referenced on every iteration of the each() loop
3. The .then() is a promise to be fulfilled if the get() call is successful. However, what value is stored into 'xml' from get() if it's successful. And WHY do we need to pass 'xml' to our selection along with record? Why are double quotes allowed, when the literature I have read for this requires single quotes?
4. Can you briefly explain the necessity for the 'this' keyword in the selection. I have used it plenty, but maybe there are subtleties I don't quite understand in this statement.
Thanks again, I have learned quite a bit so far.
JohnBarulich1
7 years agoQrew Cadet
Thanks again Dan,
In your code:
In your code:
$("record", xml).each(function() {What is the optimal way to locate selection names when you don't know what they are called i.e. "record_id_", how did you know this was the name in the html? Am I able to reference the field ID from a selection statement?
var rid = $("record_id_", this).text();
var name = $("function_name", this).text();
var type = $("result_type", this).text();
console.log(rid, name, type);
});