Search code examples
lotus-noteslotus-dominolotusscriptlotus-formula

How to convert data to Ascii using Lotusscript?


I have a lotus script field in my form build using Domino Designer. This field allows user to store Lotus Multi-Byte Character Set string as well. However i want to convert this to an ASCII string. I always used the @Ascii() function in formula language to convert it in my view column defination. However i plan to do this in the Exiting() function in lotus script Can someone please help me to do a similar operation in lotusscript ?

Formula Language

@Ascii(@Text(Employee_Name)) 

LotusScript:

Sub Exiting(Source As Field)

    Employee_Name = Asc(Employee_Name)  // does not work

End Sub

Solution

  • First of all: there is one big error in your question: there is no "LotusScript- field" in Lotus Notes. All editable fields have LotusScript- Events, but the main language for fields is Formula. With formula you can define Default- Values, Input- Validations and -this is important for your question- Input- Translations. The Input- Translation- Event can contain formulas to transform the content of the field before storing it.

    Of course you can write these 10 lines of code in QuerySave. But you can also just put this formula in the input translation of the field:

    @Ascii( @ThisValue )
    

    It's your decision...