Learn JavaScript on the Now Platform: Lab 6a Answer - Functions and arrays

preview_player
Показать описание
"This video demonstrates one possible answer to lab 6a.

Рекомендации по теме
Комментарии
Автор

In case you get what I get:
0:00:00.015] Compacting large row block (file.write: incident 10000 rows 160000 saveSize)
[0:00:00.015] Compacting large row block (file.write: incident 10000 rows 160000 saveSize)

I suggest you set the limit of the incidents:


function listRecords(tableName) {
var answer = [];

var recGr = new GlideRecord(tableName);
recGr.addActiveQuery();
recGr.setLimit(5);
recGr.query();

while(recGr.next()){

}
return answer;
}


danilodraskovic
Автор

Hi Chuck,


I tried in a different way to produce the solution. it is particularly for incident table


Below is the script:



var array = [];
var incGr = new GlideRecord ('incident');
incGr.addQuery('priority', '1');
incGr.query();

while(incGr.next()){
var arraylist =

}


Getting result as below:


*** Script: undefined
*** Script: undefined
*** Script: undefined
*** Script: undefined
*** Script: undefined
*** Script: undefined
*** Script: undefined
*** Script: undefined
*** Script: undefined
*** Script: undefined
*** Script: undefined
*** Script: undefined
*** Script: undefined
*** Script: undefined
*** Script: undefined
*** Script: undefined
*** Script: undefined
*** Script: undefined
*** Script: undefined
*** Script: undefined
*** Script: undefined
*** Script: undefined
*** Script: undefined
*** Script: undefined




Please check and confirm the issue in script.


Awaiting your response on this.

rajeshbhise
Автор

The gap in my learning curve is so hard that I left the playlist for month. Is there an intermediate exercice available ? To better understand all the elements from previous lessons. Felt lost Chuck

aurelianoghinabban
Автор

Hi chuck,


i got it write using this code, can you let me know whether this is correct ?


var list = [];
function f(t){
var incGr = new GlideRecord(t);
incGr.query();

while (incGr.next()) {

}

return list.join('\t');

}
answer = f('problem');
gs.info('list=\n' +answer);

Hash
Автор

var list = [];
var gr = new GlideRecord ('incident');
gr.query();

while (gr.next()) {
list.push
}
gs.info ('list=\n' + list.join('\n'));

jagdishc
visit shbcf.ru