ReferenceError: $ is not defined

Hello Everyone!

This might be very simple but I need help on how to get the value of a Required Quantity measure from a metric set/data label and pass it onto a label text using a script.

I placed below script onto the Loading event/action but I’m seeing no data on the label and getting an error ReferenceError: reqqty is not defined in developer tool.

var measure = reqqty.metricSetBindings[0].dataResult.cellset.cells[0][0].value;
label1.labelText = measure;

Appreciate it in advance!

Have you checked that reqqty is indeed the right name you want?
Also, if you are doing it on loading, perhaps it’s not loaded yet. Try putting it on ready.

Hi David,

reqqty is just a name I renamed instead datalabel1. I also tried placing the script on Ready and Page Ready event but I get the same error. I did try to place the script onto a button component clicked event to test and it worked. So I know the script worked on a clicked event but not on the loading event.

Hi Maria,

You’ll have to move the script from the dashboard’s Loading action to its Ready action. The reason is that with Loading, there is no guarantee that the components or data visualizations are ready to use, which is why you get that reference error about reqqty not being defined.
Ready fires when the dashboard has finished loading, and all components and data visualizations are ready to use.

Let me know if that solves it for you.

Thank you. I’ll try a different route to get this implemented…