HPE Morpheus Enterprise
1846174 Members
2922 Online
110254 Solutions
New Discussion

Report plugin - Input filter transformations

 
Ollie-Phillips
HPE Pro

Report plugin - Input filter transformations

Working on a custom report for a customer, I needed to add two OptionTypes in the plugin provider to capture some data to be used in the report filter (start and end date). They were text fields. I expected that users would key in full dates in both fields i.e no helpers/pickers.

I set values of startDate and endDate in the fieldName property and compiled and uploaded the report while testing.

I was surprised that in the report filter modal, a date in US format was presented in both fields and further, that clicking presented a date picker.

It occurred to me that the Morpheus UI is transforming my fields via CSS/JavaScript based on my naming.

By changing only the fieldName properties to startMonth and endMonth, the UI then presented a monthPicker .

This is the configuration of one of the OptionTypes in the report provider (which presents a month picker):

    // end date
    OptionType endDate = new OptionType(
        code: 'end-date',
        name: 'EndDate',
        fieldName: 'endMonth',
        fieldContext: 'config',
        fieldLabel: 'End date',
        displayOrder: 1,
        inputType: OptionType.InputType.TEXT
    )

Note there is nothing in the inputType property which would suggest it would present as anything other than a HTML text input.

Tagged as experimental, but I thought was really cool and worth sharing. I don’t know yet how any transformations in the UI will be presented and so parsed in the report provider I’m working on, or whether there is chance of collisions given the control naming.



I work at HPE
HPE Support Center offers support for your HPE services and products when and how you need it. Get started with HPE Support Center today.
[Any personal opinions expressed are mine, and not official statements on behalf of Hewlett Packard Enterprise]
Accept or Kudo