Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert Token from ValueHelpDialog into Filters in SAPUI5

Tags:

sapui5

I am using a ValueHelpDialog with range support. So these tokens are generated based upon selection and values entered. e.g. For 'contains' a Token like *abc* is generated and for 'equal to', =abc is generated. These tokens can be fetched on clicking OK on the ValueHelpDialog as seen below.

enter image description here

I need to create a sap.ui.model.Filter for these selections. How can I evaluate the Tokens to retrieve FilterOperator and the value to be filtered?

Kindly assist, Thanks!

like image 688
d33a Avatar asked Dec 20 '25 02:12

d33a


1 Answers

You can retrieve the filter data from the token with the data function.

const oProperties = oToken.data("range");
/*
{
  exclude: false,
  operation: "Contains",
  keyField: "PROPERTY_PATH",
  value1: "abc",
  value2: null
}
*/

const oFilter = new Filter({
  path: oProperties.keyField,
  operator: FilterOperator[oProperties.operation],
  value1: oProperties.value1
});

like image 54
Voyager Avatar answered Dec 23 '25 23:12

Voyager



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!