ordt.redactNumber( column as String, options as object? ) as columnBinding
This function redacts a column by generating a random number within a configurable range either as a numeric data type or as a formatted string. This function can be used with op.bind or op.select .
Parameters | |
---|---|
column | The name of the column to be redacted. This can be either a string or the return value from op.col, op.viewCol, or op.schemaCol. |
options | The options for masking the value the column. |
The options consist of the following properties:
0
default).18446744073709551615
default).integer
(the default), decimal
, or double
;
the min and max values must have the same data type.const op = require('/MarkLogic/optic'); const ordt = require('/MarkLogic/optic/optic-redaction.sjs'); op.fromView('main', 'employees') .bind([ ordt.redactNumber(op.schemaCol('main', 'employees', 'salary'), {type:'decimal', min:50000, max:500000, format:'$###,##0.00'}) ]) .result();
const op = require('/MarkLogic/optic'); const ordt = require('/MarkLogic/optic/optic-redaction.sjs'); op.fromView('main', 'employees') .select([ ordt.redactNumber(op.schemaCol('main', 'employees', 'salary'), {type:'decimal', min:50000, max:500000, format:'$###,##0.00'}) ]) .result();
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.