Is there an option to declare global variables? A MaskAfterDate for example.
SS123456
Posts: 3 New member
Is there a way to declare a date variable that can be accessed by different rules in a masking set?
For example, if we wanted to mask all transactions older than 30 days, we could declare @MaskDate = GETDATE()-30, then mask all invoice data with an invoice date older than @MaskDate. In another rule mask all shipping data with a ship date older than @MaskDate, etc.
For example, if we wanted to mask all transactions older than 30 days, we could declare @MaskDate = GETDATE()-30, then mask all invoice data with an invoice date older than @MaskDate. In another rule mask all shipping data with a ship date older than @MaskDate, etc.
Tagged:
Answers
In the example you give, the easiest way of handling this would be with a WHERE clause set on the Substitution Rule - you could create a Substitution rule with Date Variance, Random DataSets, and then on the WHERE clause and Sampling tab simply enter a custom where clause, e.g. if you were masking the column ShipDate:
WHERE ShipDate < GETDATE()-30
Although obviously you will need a separate Substitution rule for this, or it will limit any other rows on the table you would like to be masked!
Another way of handling this would be with a Row-Internal Sync Rule.
You could easily write a CASE statement to catch all instances of this and mask it as required e.g. if you were making the column ShipDate it might be:
CASE WHEN ShipDate < GETDATE()-30 THEN DMSPARAM1 ELSE ShipDate END
Where you have DMSPARAM1 set to Dates, Random.
I hope this helps? Let me know if you have any further questions!