API Reference: String Rollup
  • Request
    a trial
  • Request
    a demo
  • Request
    a quote
Search
OpenNavigationArticle
API Data Masking Components
OpenNavigationArticle
Open Navigation Article
API Reference: String Rollup
  • Request
    a trial
  • Request
    a demo
  • Request
    a quote
String Rollup API

String Rollup API

API function

.NET:

string HushHush.MaskingLogic.SSRS.Mask.StringRollup(string data, string rangesConfiguration, string defaultReplacement, RollupConfigurationFormat format = RollupConfigurationFormat.Xml)

Expected input

data: value to be masked. 

rangesConfiguration: proper rollup ranges in XML or CSV format. 

defaultReplacement: default replacement for values not covered by rollup ranges. 

format: RollupConfigurationFormat.Xml (default) or RollupConfigurationFormat.Csv. Selects whether rangesConfiguration is XML or CSV. 

Expected output

Masked string 

Error handling

InvalidOperationException when the rollup configuration is invalid. For XML (“There is an error in XML document”), the details are in the inner exception. For CSV, the message names the row and column of each problem, and ArgumentException is thrown when the configuration is null or empty. An empty XML configuration is not an error: every value gets defaultReplacement. The message does not include the value being masked. InvalidOperationException is also thrown when a regular expression takes longer than 1 second to match a value. 

Examples

Use MatchValues (XML) or the optional CustomValues column to catch specific values that should map to a replacement but don't fit the Pattern filter — for example, placeholder values like "N/A" or "UNKNOWN" that appear in otherwise pattern-matched data. 

string rangesXML =
    "<?xml version=\"1.0\" encoding=\"utf-16\"?>" +
    "<ArrayOfRollupOfString xmlns:xsi=" +
    "\"http://www.w3.org/2001/XMLSchema-instance\" " +
    "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">" +
    "  <RollupOfString>" +
    "    <Replacement>" +
    "      <string>902**</string>" +
    "    </Replacement>" +
    "    <Filter type=\"Substring\">" +
    "      <SubstringRollupFilter>" +
    "        <Pattern>902\\d{2}</Pattern>" +
    "        <IgnoreCase>false</IgnoreCase>" +
    "        <UseRegex>true</UseRegex>" +
    "      </SubstringRollupFilter>" +
    "    </Filter>" +
    "    <MatchValues />" +
    "  </RollupOfString>" +
    "  <RollupOfString>" +
    "    <Replacement>" +
    "      <string>90100</string>" +
    "    </Replacement>" +
    "    <Filter type=\"Substring\">" +
    "      <SubstringRollupFilter>" +
    "        <Pattern>901\\d{2}</Pattern>" +
    "        <IgnoreCase>false</IgnoreCase>" +
    "        <UseRegex>true</UseRegex>" +
    "      </SubstringRollupFilter>" +
    "    </Filter>" +
    "    <MatchValues>" +
    "      <Value>" +
    "        <string>N/A</string>" +
    "      </Value>" +
    "      <Value>" +
    "        <string>UNKNOWN</string>" +
    "      </Value>" +
    "    </MatchValues>" +
    "  </RollupOfString>" +
    "</ArrayOfRollupOfString>";
    
HushHush.MaskingLogic.SSRS.Mask.StringRollup("90109", rangesXML, "***") // "90100"     
HushHush.MaskingLogic.SSRS.Mask.StringRollup("90209", rangesXML, "***") // "902**"     
HushHush.MaskingLogic.SSRS.Mask.StringRollup("mask-me", rangesXML, "***") // "***"    

HushHush.MaskingLogic.SSRS.Mask.StringRollup("N/A", rangesXML, "***") // "90100" – matched via MatchValues, not Pattern 

Note: XML written by earlier versions using the full assembly-qualified type value still loads correctly. <MatchValues> lists values that are matched as a whole value, independent of Pattern. Letter case is always ignored for these values, whatever IgnoreCase is set to. Add one element per value, as shown above on the second rule.

using HushHush.MaskingLogic.Helpers; // for RollupConfigurationFormat 

string rangesCsv = "Pattern,IgnoreCase,UseRegex,Replacement,CustomValues" + System.Environment.NewLine + "902\d{2},false,true,902**," + System.Environment.NewLine + "901\d{2},false,true,90100,"N/A" + System.Environment.NewLine + "UNKNOWN""; 
          
HushHush.MaskingLogic.SSRS.Mask.StringRollup("90109", rangesCsv, "***", RollupConfigurationFormat.Csv) // "90100"     
HushHush.MaskingLogic.SSRS.Mask.StringRollup("90209", rangesCsv, "***", RollupConfigurationFormat.Csv) // "902**"     
HushHush.MaskingLogic.SSRS.Mask.StringRollup("mask-me", rangesCsv, "***", RollupConfigurationFormat.Csv) // "***"     

HushHush.MaskingLogic.SSRS.Mask.StringRollup("N/A", rangesCsv, "***", RollupConfigurationFormat.Csv) // "90100" – matched via the optional 5th column, not Pattern 


Note: The first row is a header: Pattern,IgnoreCase,UseRegex,Replacement. The optional CustomValues column holds newline-separated values that are matched as a whole value. Letter case is always ignored for these values, whatever IgnoreCase is set to. It is shown above on the second row, where it matches “N/A” and “UNKNOWN” independently of Pattern. Every row must have as many values as the header. Leave CustomValues empty with a trailing comma, as in the first row.

About Hush-Hush Contact Us

E-mail: info@mask-me.net

tel: 855.968.4874

Privacy Policy Terms of Use