like this:
/// using $ZZFIX() custom function
Class rcc.GetFixZZ Extends %Library.String
{
Parameter LENGTH As %String = 10;
Parameter ALIGN As %String = "LEFT";
Parameter PADCHAR As %String = " ";
Method Get() As %String [ CodeMode = generator, ServerOnly = 1 ]
{
set code=+%parameter("LENGTH")_","""_$E(%parameter("PADCHAR")_" ",1)_""""
set code=code_","_("RIGHT"=$zcvt(%parameter("ALIGN"),"U"))_")"
$$$GENERATE(" quit $ZZFIX(%val,"_code )
QUIT $$$OK
}
ClassMethod StorageToLogical(%val As %String) As %String [ CodeMode = generator, ServerOnly = 1 ]
{
set code=+%parameter("LENGTH")_","""_$E(%parameter("PADCHAR")_" ",1)_""""
set code=code_","_("RIGHT"=$zcvt(%parameter("ALIGN"),"U"))_")"
$$$GENERATE(" quit $ZZFIX(%val,"_code )
QUIT $$$OK
} }- Log in to post comments