BLO: subcribe histdata

Hello Rapid m2m community,

is there an example code of how to subscribe to the hist data in the BLO?
An example of a subscription to the sites is listed in the help, but I don’t get it adapted for the hist channels.

Best regards,
Marcel

Hi,
below a sample how to subscribe to histdata0

BAPI.subscribe('histdata0', { select: ['val1_avg', 'val1_max'] })
	.onUpdate(async (data, context) => {

	})
	.onDelete(async _uid => {
	    //onDelete is called when a site was removed
	})
	.onInitialized(async () => {

	});

Kind regards,
Jakob

Hi Jakob,

thank you very much!
The designation of the individual variables of the hist channel (‘val1_avg’, ‘val1_max’) did not matched in my code.
It works now.

Best regards,
Marcel