Page 1 of 1

Exporting checkgroup in report

Posted: Thu Oct 24, 2019 9:54 am
by ebryant
Hello,

I've been trying to capture the values in a checkgroup to export from reporting. I've followed the instructions described in the below link:

https://wiki.processmaker.com/3.1/Repor ... ort_Tables

I've created the following trigger:

//export the values of a checkgroup as a JSON string
@@CommEcojson = json_encode(@=CommEco);
@@CommEcoLabelsJson = @@CommEco;
@@DefLawjson = json_encode(@=DefLaw);
@@DefLawLabelsJson = @@DefLaw;
@@DefLaw2json = json_encode(@=DefLaw2);
@@DefLaw2LabelsJson = @@DefLaw2;
@@Mediationjson = json_encode(@=Mediation);
@@MediationLabelsJson = @@Mediation;
@@Mediation2json = json_encode(@=Mediation2);
@@Mediation2LabelsJson = @@Mediation2;
@@NonProfitjson = json_encode(@=NonProfit);
@@NonProfitLabelsJson = @@NonProfit;
@@OpenGovjson = json_encode(@=OpenGov);
@@OpenGovLabelsJson = @@OpenGov;
@@TrialPract2json = json_encode(@=TrialPract2);
@@TrialPract2LabelsJson = @@TrialPract2;
@@TrialPractjson = json_encode(@=TrialPract);
@@TrialPractLabelsJson = @@TrialPract;
@@EcoJustjson = json_encode(@=EcoJust);
@@EcoJustLabelsJson = @@EcoJust;
@@Citizenshipjson = json_encode(@=Citizenship);
@@CitizenshipLabelsJson = @@Citizenship;
@@CLEARjson = json_encode(@=CLEAR);
@@CLEARLabelsJson = @@CLEAR;

$caseNo = @@caseNo; //set by user in a previous Dynaform
$query = "SELECT CommEcojson, CommEcoLabelsJson, CLEARjson, CLEARLabeljson, DefLawjson, DefLawLableJson, DefLaw2json,
DefLaw2LabelsJson, Mediationjson, MediationLabelsJson, Mediation2json, Mediation2LabelsJson, NonProfitjson,
NonProfitLabelsJson, OpenGovjson, OpenGovLabelsJson, TrialPract2json, TrialPract2LabelsJson, TrialPractjson,
TrialPractLabelsJson, EcoJustjson, EcoJustLabelsJson, Citizenshipjson, CitizenshipLabelsJson
FROM PMT_CLIENTS_INFO where APP_NUMBER = '$caseNo' ";
$result = executeQuery($query);
if (is_array($result) and count($result) > 0) {
@=CommEco = json_decode($result[1]['CommEcojson']);
@@CommEco = $result[1]['CommEcoLabelsJson'];
@=CommEco = json_decode($result[1]['CommEcojson'], true);
@=DefLaw = json_decode($result[1]['DefLawjson']);
@@DefLaw = $result[1]['DefLawLabelsJson'];
@=DefLaw = json_decode($result[1]['DefLawjson'], true);
@=CLEAR = json_decode($result[1]['CLEARjson']);
@@CLEAR = $result[1]['CLEARLabelsJson'];
@=CLEAR = json_decode($result[1]['CLEARjson'], true);
@=DefLaw2 = json_decode($result[1]['DefLaw2json']);
@@=DefLaw2 = $result[1]['DefLaw2LabelsJson']);
@=DefLaw2 = json_decode($result[1]['DefLaw2json'], true);
@=Mediation = json_decode($result[1]['Mediationjson']);
@@=Mediation = $result[1]['MediationLabelsJson']);
@=Mediation = json_decode($result[1]['Mediationjson'], true);
@=Mediation2 = json_decode($result[1]['Mediation2json']);
@@=Mediation2 = $result[1]['Mediation2LabelsJson']);
@=Mediation2 = json_decode($result[1]['Mediation2json'], true);
@=NonProfit = json_decode($result[1]['NonProfitjson']);
@@=NonProfit = $result[1]['NonProfitLabelsJson']);
@=NonProfit = json_decode($result[1]['NonProfitjson'], true);
@=OpenGov = json_decode($result[1]['OpenGovjson']);
@@=OpenGov = $result[1]['OpenGovLabelsJson']);
@=OpenGov = json_decode($result[1]['OpenGovjson'], true);
@=TrialPract2 = json_decode($result[1]['TrialPract2json']);
@@=TrialPract2 = $result[1]['TrialPract2LabelsJson']);
@=TrialPract2 = json_decode($result[1]['TrialPract2json'], true);
@=TrialPract = json_decode($result[1]['TrialPractjson']);
@@=TrialPract = $result[1]['TrialPractLabelsJson']);
@=TrialPract = json_decode($result[1]['TrialPractjson'], true);
@=EcoJust = json_decode($result[1]['EcoJustjson']);
@@=EcoJust = $result[1]['EcoJustLabelsJson']);
@=EcoJust = json_decode($result[1]['EcoJustjson'], true);
@=Citizenship = json_decode($result[1]['Citizenshipjson']);
@@=Citizenship = $result[1]['CitizenshipLabelsJson']);
@=Citizenship = json_decode($result[1]['Citizenshipjson'], true);
}

and inserted it into the task 1 script of a web application as below, the script only works for a very few of the checkboxes leaving most with either NULL or [] values.: