@Formula Snippet – Strip leading zeros from @NoteId

We use @NoteId in a view to get the NoteId of a document and display the value in a column. Via NotesNavigator, we access this column ( and others ) Unfortunately, the value, that is returned by the formula is something like NT0000903.

When we pass this value to our function, to open the document in a tabContainer, it fails because the function excepts only the number part wthout the NT and leading zeros. ( = 903 ). So I was looking for a way to stip the unwanted part from the string.

Here is, what I came out with

tmp:=@ReplaceSubstring(@NoteID;"NT";"");
@Do(tmp := tmp;@While(@Length(tmp) > 1 & @Begins(tmp; "0");tmp := @Middle(tmp; 1; 8));tmp) ;

If there is a better solution, let me know. We tried many things, but to go thru the value from left to right and checking, if the string begins with a “0” seems to be the best way to achieve the aim.