Apply mask on displayed data

I am looking for the best approach to apply a mask on my data before displaying them to a user (doing some sort of string replace). I don’t want to change the data itself on postgress nor on cassandra and would like to strictly use the UI Framework/Type System.

There is way in javascript to apply regex on elements of the webpage and therefore change the data after page load. I can inject such a javascript function on my pages in the behavior json object.

But Is there a more efficient/elegant way that I should considered ?

Data sources have the fields responseTransform and customResponseTransform where you can specify a data transformation to apply before storing the data in the UI. See the UIDirectory topic in documentation for more info.

KendoGrids also have a format field in which you can specify how you want to display the data (rounding to an integer, eg) but this can be passed a custom function as well in the funk field.

You may still need to implement your transformation in javascript but this coheres to UI standards.

I tend to think that every use of responseTransform is a bug. Another way to approach this is as follows:

entity type YourType {
  field: string // the real data
  display: string calc "replace(field, 'the_string_i_want_to_replace', 'the_replacement')"

From the UI’s perspective the field “display” is just as valid as the field “field”, but it won’t be stored anywhere.

Got it thanks @tali @rileysiebel !