Search code examples
lotus-noteslotus-formuladomino-designer-eclipse

lotus notes domino designer text field contains special characters?


My Lotus notes field allows special characters to be stored in the text box for example Franco Martínez, José Ramó this name has special character í, é, ó How do i not allow user to paste such character ?

Also, when i create a view can I convert this to a simple string using a method so that it does not contain special characters ?


Solution

  • Over the input validation of an field you can use a @Fomular to post an failure when the User use one of these characters. Use something like this

    enter image description here

    @If( @Contains(Field_1;"í");@Failure("no í");@Contains(Field_1;"é");@Failure("no é");@Contains(Field_1;"ó");@Failure("no ó");@Success)
    

    If you like to change the characters of exsitings doc, you can use an LS Agent which change characters of the marked documents in a view.

    Dim session As New NotesSession
    Dim doccol As NotesDocumentCollection
    Dim doc As NotesDocument
    Dim eval As variant
    
    
    
    Set doccol =session.Currentdatabase.Unprocesseddocuments
    If doccol.Count =0 Then
        MsgBox "please mark docs" ,0, "please mark docs"
        Exit sub
    End If
    
    Set doc = doccol.Getfirstdocument()
    
    
    Do Until doc Is Nothing
    
        eval = Evaluate({@Replacesubstring(Field_1;"í":"ó":"é";"i":"o":"e")}, doc)
        Call doc.Replaceitemvalue("Field_1", eval)
        Call doc.Save(true,false, true)
        Set doc = doccol.Getnextdocument(doc)
    Loop
    

    To change the characters in a view column just take

    @Replacesubstring(columnvalue;"í":"ó":"é";"i":"o":"e")