Scripts in Custom Form not running in Dataset report mode

I have some custom Forms with Scripts to perform a variety of summaries which takes time to achieve with indicators. These scripts are not working in Dataset mode.

Is there something that I have to do to be able to run them in Dataset mode?

Thanks

Hi @dmaritim,

What kind of problem are you having? Share a little detail. You can check the below example to call any api inside data entry form or can do any calculation:

dhis2.util.on( 'dhis2.de.event.formReady', function( event, aLpVgfXiz0f) {

var orgName= $( '#selectedOrganisationUnit' ).val();// From DHIS2 Selection Param
jQuery.get("https://play.dhis2.org/2.31dev/api/organisationUnits.json?query="+orgName+"&fields=id,level",function(jsonResponse){
	$.each(jsonResponse, function(key, value){
		var arr = [];
		for(var info in value){
		  arr.push(value[info]);
		}
		var level =value[info]['level'];
		if(typeof level != 'undefined'){
		 console.log({level});
		}
   });
  });
});

 

You can find more custom scripts here: http://dhis2trainingland.com/eportal/

Thanks
Julhas

@julhas
All my Scripts are working perfectly in the Dataentry Module. The summaries are done accurately, however, in the Dataset report mode, those summaries disappear even the console.log() outputs. It is like those scripts done run at all.

Check example below:

dhis2.util.on(dhis2.de.event.dataValuesLoaded, function(event, ds) {
console.log(“DataValueLoaded function runned”);
myfunction.loadWithDelay();
});

Hi all,

My investigation has taken me through various Scripts in DHIS2. Of interest is the dataSetReport.js especially towards the end where you have the below script. What does this mean?
/------------------------------------------------------------------------------
// Hooks in custom forms - must be present to avoid errors in forms
//------------------------------------------------------------------------------

function onValueSave( fn )
{
// Do nothing
}

function onFormLoad( fn )
{
// Do nothing
}

Need help.

Hi Members,

Still looking for help in ensuring that JQuery scripts for dhis2.de.event.dataValuesLoaded are running when a dataset is open in dataset report module.

Are there known issues that prevent this event from running in dataet report module?

Your help is highly appreciated.