Return count of lines in first datawindow dw_1
alert(window.document.dw_1.rowCount());
if document not defined, it's using datawindow dw_1 from current window/document
alert(dw_1.rowCount());
Example
let lc_sum=0;
for (let ll_row=1;ll_row<=dw_1.rowcount();ll_row++)
lc_sum += dw_1.item.onHand[ll_row];
alert("Stock for all items: "+lc_sum);