@Replace function
Forums
Hi there,
I'm trying to replace my first numeric to a new numeric, e.g. from 38 to 88.
I try put in @Replace(USERID,"38","88") and it prompted me an 'Invalid parameter'.
Any idea what goes wrong here or there is other @function that I could actually use.
Thanks.
William
assuming USERID is a numeric
assuming USERID is a numeric field and you want the virtual field you are creating to be numeric, your equation would be: (This assumes your userids are 2 digits long. if they are longer, change the second parameter in your @str function)
@val(@replace(@str(USERID,2,0),"38","88"))
Hi William,
Hi William,
Just to clarifiy something, you cannot replace the numbers in your original field. You need to append a new field using the field manipulation feature from the ribbon bar, or right click on your current userid field and choose the first choice insert a new field. As a side note, numeric, or virtual numeric fields are always a length of 8 no matter how large the number is inside the field. In your case, you may have USERID's that contain 2 digits, 4 digits, 8 digits, or 12 digits then in your new field, your formula above will change will change all 3's to 8's no matter what position they fall 1 through 12 in your original field.
Hope that clears it up ofr you.
My first thought would be as
My first thought would be as to whether you are actually running this function on a character field? If not can you convert the numeric field to a character and then then run the function?