# Report-level independent
TableField.create('report_independent', 'Report Independent', obj=report)

# Report-level computed
TableField.create('report_computed',
                  'Reprot computed',
                  obj=report,
                  post_process_template='report_computed:{report_independent}',
                  hidden=False)

# Section
section = report.add_section(title='Section 0')

# Section-level computed
TableField.create(keyword='section_computed',
                  obj=section,
                  post_process_template='section_computed:{report_computed}',
                  hidden=False)

# Table
a = CriteriaTable.create('test-criteria-parents')

# Table-level computed
TableField.create(keyword='table_computed',
                  obj=a,
                  post_process_template='table_computed:{section_computed}',
                  hidden=False)

report.add_widget(raw.TableWidget, a, 'Table')
Пример #2
0
from steelscript.appfwk.apps.datasource.modules.analysis import CriteriaTable

from steelscript.appfwk.apps.report.models import Report, TableField
from steelscript.appfwk.apps.report.modules import raw

report = Report.create(title='Criteria Circular Dependency')
report.add_section()

a = CriteriaTable.create('test-criteria-circulardependency')

TableField.create(keyword='t1', obj=a,
                  post_process_template='table_computed:{t2}',
                  hidden=False)

TableField.create(keyword='t2', obj=a,
                  post_process_template='table_computed:{t3}',
                  hidden=False)

TableField.create(keyword='t3', obj=a,
                  post_process_template='table_computed:{t1}',
                  hidden=False)

report.add_widget(raw.TableWidget, a, 'Table')
report = Report.create(title='Criteria Parents',
                       hidden_fields=['report_computed',
                                      'section_computed',
                                      'table_computed'])

# Report-level independent
TableField.create('report_independent', 'Report Independent', obj=report)

# Report-level computed
TableField.create('report_computed', 'Reprot computed', obj=report,
                  post_process_template='report_computed:{report_independent}',
                  hidden=False)

# Section
section = report.add_section(title='Section 0')

# Section-level computed
TableField.create(keyword='section_computed', obj=section,
                  post_process_template='section_computed:{report_computed}',
                  hidden=False)

# Table
a = CriteriaTable.create('test-criteria-parents')

# Table-level computed
TableField.create(keyword='table_computed', obj=a,
                  post_process_template='table_computed:{section_computed}',
                  hidden=False)

report.add_widget(raw.TableWidget, a, 'Table')
from steelscript.appfwk.apps.datasource.modules.analysis import CriteriaTable
from steelscript.appfwk.apps.datasource.models import TableField
from steelscript.appfwk.libs.fields import Function

from steelscript.appfwk.apps.report.models import Report
from steelscript.appfwk.apps.report.modules import raw
from . import criteria_functions as funcs

report = Report.create(title='Criteria Post Process')

section = report.add_section(title='Section 0')

a = CriteriaTable.create('test-criteria-postprocess')

TableField.create('w', 'W Value', a)
TableField.create('x', 'X Value', a)
TableField.create('y', 'Y Value', a)

for (f1, f2) in [('w', 'x'), ('w', 'y'), ('x', 'y')]:
    (TableField.create
     ('%s%s' % (f1, f2), '%s+%s Value' % (f1, f2), a,
      hidden=True, parent_keywords=[f1, f2],
      post_process_func=Function(funcs.postprocess_field_compute,
                                 params={'fields': [f1, f2]})))


report.add_widget(raw.TableWidget, a, 'Table')
from steelscript.appfwk.apps.report.models import Report
import steelscript.appfwk.apps.report.modules.raw as raw
from steelscript.appfwk.apps.datasource.forms import fields_add_time_selection
from steelscript.appfwk.apps.datasource.modules.analysis import CriteriaTable

report = Report.create(title='Criteria Time Selection')
report.add_section()

a = CriteriaTable.create('test-criteria-timeselection')
fields_add_time_selection(a, initial_duration='1 day')

report.add_widget(raw.TableWidget, a, 'Table')
from steelscript.appfwk.apps.datasource.modules.analysis import CriteriaTable

from steelscript.appfwk.apps.report.models import Report, TableField
from steelscript.appfwk.apps.report.modules import raw

report = Report.create(title='Criteria Two Reports - 2')

TableField.create(keyword='k2', label='Key 2', obj=report, initial='r2')

# Section
report.add_section(title='Section')

# Table
a = CriteriaTable.create('test-criteria-tworeports-2')
TableField.create(keyword='k1', label='Key 1', obj=a, initial='r1')

report.add_widget(raw.TableWidget, a, 'Table 2')
Пример #7
0
from steelscript.appfwk.apps.report.models import Report
from steelscript.appfwk.apps.report.modules import raw
from steelscript.appfwk.apps.report.tests.reports \
    import criteria_functions as funcs

report = Report.create(title='Criteria Pre Process')

section = report.add_section(title='Section 0')

TableField.create('choices',
                  'Choices',
                  section,
                  field_cls=forms.ChoiceField,
                  pre_process_func=Function(funcs.preprocess_field_choices))

TableField.create('choices_with_params',
                  'Choices with params',
                  section,
                  field_cls=forms.ChoiceField,
                  pre_process_func=Function(
                      funcs.preprocess_field_choices_with_params,
                      params={
                          'start': 1,
                          'end': 3,
                          'prefix': 'pre'
                      }))

a = CriteriaTable.create('test-criteria-preprocess')

report.add_widget(raw.TableWidget, a, 'Table')
from django import forms

from steelscript.appfwk.apps.datasource.modules.analysis import CriteriaTable
from steelscript.appfwk.libs.fields import Function
from steelscript.appfwk.apps.report.models import Report, TableField
from steelscript.appfwk.apps.report.modules import raw
from . import criteria_functions as funcs

report = Report.create(title='Criteria Changing',
                       field_order=['first', 'second'])
section = report.add_section(title='Section 0')

TableField.create('first', 'First Choice', section,
                  field_cls=forms.ChoiceField,
                  field_kwargs={'choices': (('a', 'Option A'),
                                            ('b', 'Option B'))})

TableField.create('second', 'Second Choice', section,
                  field_cls=forms.ChoiceField,
                  pre_process_func=Function(funcs.preprocess_changesecond),
                  dynamic=True)

a = CriteriaTable.create('test-criteria-changingchoices')
report.add_widget(raw.TableWidget, a, 'Table')
Пример #9
0
from steelscript.appfwk.apps.datasource.models import TableField

from steelscript.appfwk.apps.report.models import Report
from steelscript.appfwk.apps.report.modules import raw

report = Report.create(title='Criteria Defaults')

# Report-level criteria
TableField.create('report-1', 'Report 1', obj=report, initial='r1')
TableField.create('report-2', 'Report 2', obj=report, required=True)

# Section
section = report.add_section(title='Section 0')

# Section-level criteria
TableField.create('section-1', 'Section 1', obj=section, initial='s1')
TableField.create('section-2',
                  'Section 2',
                  obj=section,
                  required=True,
                  initial='s2')

# Table
a = CriteriaTable.create('test-criteria-defaults')

# Table-level criteria
TableField.create('table-1', 'Table 1', obj=a, initial='t1')
TableField.create('table-2', 'Table 2', obj=a, initial='t2')

report.add_widget(raw.TableWidget, a, 'Table')
from django import forms

from steelscript.appfwk.apps.datasource.modules.analysis import CriteriaTable
from steelscript.appfwk.apps.datasource.models import TableField

from steelscript.appfwk.apps.report.models import Report
from steelscript.appfwk.apps.report.modules import raw

report = Report.create(title='Criteria Bool')

# Section
section = report.add_section(title='Section 0')

# Table
a = CriteriaTable.create('test-criteria-bool')

# Table-level criteria
TableField.create('b1', 'Bool True', obj=a,
                  field_cls=forms.BooleanField, initial=True)
TableField.create('b2', 'Bool False', obj=a,
                  field_cls=forms.BooleanField, initial=False)

report.add_widget(raw.TableWidget, a, 'Table')
from steelscript.appfwk.apps.datasource.modules.analysis import CriteriaTable
from steelscript.appfwk.apps.datasource.models import TableField

from steelscript.appfwk.apps.report.models import Report
from steelscript.appfwk.apps.report.modules import raw

report = Report.create(title='Criteria Defaults')

# Report-level criteria
TableField.create('report-1', 'Report 1', obj=report, initial='r1')
TableField.create('report-2', 'Report 2', obj=report, required=True)

# Section
section = report.add_section(title='Section 0')

# Section-level criteria
TableField.create('section-1', 'Section 1', obj=section, initial='s1')
TableField.create('section-2', 'Section 2', obj=section, required=True, initial='s2')

# Table
a = CriteriaTable.create('test-criteria-defaults')

# Table-level criteria
TableField.create('table-1', 'Table 1', obj=a, initial='t1')
TableField.create('table-2', 'Table 2', obj=a, initial='t2')

report.add_widget(raw.TableWidget, a, 'Table')
from steelscript.appfwk.apps.datasource.modules.analysis import CriteriaTable
from steelscript.appfwk.apps.datasource.models import TableField
from steelscript.appfwk.libs.fields import Function

from steelscript.appfwk.apps.report.models import Report
from steelscript.appfwk.apps.report.modules import raw

from steelscript.appfwk.apps.report.tests.reports \
    import criteria_functions as funcs

report = Report.create(title='Criteria Post Process Errors')

section = report.add_section(title='Section 0')

a = CriteriaTable.create('test-criteria-postprocess-errors')

TableField.create('error', 'Error type', a)
TableField.create('x',
                  'X Value',
                  a,
                  hidden=True,
                  post_process_func=Function(funcs.postprocesserrors_compute))

report.add_widget(raw.TableWidget, a, 'Table')
Пример #13
0
from django import forms

from steelscript.appfwk.apps.datasource.modules.analysis import CriteriaTable
from steelscript.appfwk.apps.datasource.models import TableField

from steelscript.appfwk.apps.report.models import Report
from steelscript.appfwk.apps.report.modules import raw

report = Report.create(title='Criteria Bool')

# Section
section = report.add_section(title='Section 0')

# Table
a = CriteriaTable.create('test-criteria-bool')

# Table-level criteria
TableField.create('b1',
                  'Bool True',
                  obj=a,
                  field_cls=forms.BooleanField,
                  initial=True)
TableField.create('b2',
                  'Bool False',
                  obj=a,
                  field_cls=forms.BooleanField,
                  initial=False)

report.add_widget(raw.TableWidget, a, 'Table')
from steelscript.appfwk.apps.datasource.modules.analysis import CriteriaTable
from steelscript.appfwk.apps.datasource.models import TableField
from steelscript.appfwk.libs.fields import Function

from steelscript.appfwk.apps.report.models import Report
from steelscript.appfwk.apps.report.modules import raw

from steelscript.appfwk.apps.report.tests.reports \
    import criteria_functions as funcs

report = Report.create(title='Criteria Shared Fields')

x = TableField.create('x', 'X Value')
for i in range(2):

    section = report.add_section(title='Section %d' % i)

    a = CriteriaTable.create('test-criteria-sharedfields-%d' % i)

    a.fields.add(x)
    y = TableField.create('y',
                          'Y Value',
                          a,
                          hidden=True,
                          parent_keywords=['x'],
                          post_process_func=Function(
                              funcs.sharedfields_compute,
                              params={'factor': 10 * (i + 1)}))

    report.add_widget(raw.TableWidget, a, 'Table %d' % i)