Check your TRUNCATE parameter.
Common Parameters:TRUNCATE TRUNCATE — Specifies whether to truncate the string to MAXLEN characters, where 1 is TRUE and 0 is FALSE. This parameter is used by the Normalize() and IsValid() methods but is not used by database drivers.
Class dc.test Extends %Persistent
{
Property s1 As %String(TRUNCATE = 1);
Property s2 As %String;
ClassMethod Test()
{
d ..%KillExtent(,$$$YES)
s t=..%New()
s t.s1=$tr($j("",51)," ","a")
s sc=t.%Save()
w "s1: ",$s($$$ISERR(sc):$system.Status.GetErrorText(sc),1:"OK"),!
s t=..%New()
s t.s2=$tr($j("",51)," ","a")
s sc=t.%Save()
w "s2: ",$s($$$ISERR(sc):$system.Status.GetErrorText(sc),1:"OK"),!
}
}
USER>d ##class(dc.test).Test()
s1: OK
s2: ERROR #7201: Datatype value 'aaaa..aa' length longer than MAXLEN allowed of 50
> ERROR #5802: Datatype validation failed on property 'dc.test:s2', with value equal to "aaaa..aa"
The same error occurs in the Management Portal.
- Log in to post comments