4 Replies Latest reply on Apr 14, 2015 6:36 AM by illbe

# Variable masked serial# question, serial character length varies

### Title

Variable masked serial# question, serial character length varies

### Post

I have a calculated field that masks the last two numbers of a serial#:

Let ( serial = Filter ( serial ; "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" ) ; Left ( serial ;4 )  & "xx" )

My problem is that I need to apply this to a serial field that has variable length serials, I am not sure how to fit this in my calculation.

Any help is always appreciated.

Tom

• ###### 1. Re: Variable masked serial# question, serial character length varies

Let ( [ serial = Filter ( serial ; "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" ) ;
Ln = Length ( Serial ) - 4 ;
mask = Substitute ( 10^Ln - 1 ; 9 ; "x" )
];
Left ( serial ;4 )  & mask
)// let

• ###### 2. Re: Variable masked serial# question, serial character length varies

I'm sorry Phil I don't think I explained what I'm trying to do very well, my mistake. What I wanted to happen is to mask ONLY the last 2 characters of the serial# but let the rest show i.e. C1999xx or 123445678xx.

I'm sorry I didn't explain that.

Thank you for the above solution as well however :-).

• ###### 3. Re: Variable masked serial# question, serial character length varies

Left ( serial ; Length ( serial ) - 2 ) & "xx"

• ###### 4. Re: Variable masked serial# question, serial character length varies

Phil, thank you again for saving my bacon :-), you're always a huge help, I have learned more about the workings of FM from your answers to my questions than any book could offer.

All the best

Tom