Help me with accessing dataset fields

try putting your code inside $w.onReady(function () { //here });