Search in sources :

Example 1 with FormulaDialog

use of org.activityinfo.ui.client.formulaDialog.FormulaDialog in project activityinfo by bedatadriven.

the class MeasurePane method editFormula.

private void editFormula(MeasureModel measure) {
    FormulaDialog dialog = new FormulaDialog(viewModel.getFormStore(), measure.getFormId());
    dialog.show(measure.getFormula(), formula -> {
        updateMeasureFormula(measure, formula.getFormula());
    });
}
Also used : FormulaDialog(org.activityinfo.ui.client.formulaDialog.FormulaDialog)

Example 2 with FormulaDialog

use of org.activityinfo.ui.client.formulaDialog.FormulaDialog in project activityinfo by bedatadriven.

the class MeasureDialog method onCalculate.

private void onCalculate(SelectEvent event) {
    ResourceId selectedFormId = model.getSelectedForms().getList().get(0);
    FormulaDialog dialog = new FormulaDialog(model.getFormStore(), selectedFormId);
    dialog.show(null, expr -> {
        ImmutableMeasureModel measure = ImmutableMeasureModel.builder().formId(selectedFormId).formula(expr.getFormula()).label(expr.getFormula()).addStatistics(Statistic.SUM).build();
        select(measure);
    });
}
Also used : ResourceId(org.activityinfo.model.resource.ResourceId) FormulaDialog(org.activityinfo.ui.client.formulaDialog.FormulaDialog) ImmutableMeasureModel(org.activityinfo.ui.client.analysis.model.ImmutableMeasureModel)

Aggregations

FormulaDialog (org.activityinfo.ui.client.formulaDialog.FormulaDialog)2 ResourceId (org.activityinfo.model.resource.ResourceId)1 ImmutableMeasureModel (org.activityinfo.ui.client.analysis.model.ImmutableMeasureModel)1