That should not be a problem. But in testing this, I found a problem with PROTOCLASS.
I note that PROTOCLASS sets MVWIDTH based on the DICT width. You could set MAXLEN to the same value. Or, since the DICT width is generally a display width and data can wrap (not a max length), you could get fancy and use a constant or algorithm to determine the desired MAXLEN to set.
The problem I found is that MVWIDTH is only set on subsequent calls to PROTOCLASS for a DICT to reflect any changes that were made to the DICT up to the class. So the first time you run PROTOCLASS on a DICT, MVWIDTH is not set in the class. But, if you then run PROTOCLASS again, MVWIDTH is set in the class.
Rich
--
You received this message because you are subscribed to the Google Groups "InterSystems: MV Community" group.
To post to this group, send email to Cac...@googlegroups.com
To unsubscribe from this group, send email to CacheMV-u...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/CacheMV?hl=en
If you want to do it:
look for the line
"%SYSTEM.MV"->parseDict(dictFDSC, record, @ID)
and add after it
if %dictionary(%DictNumber,"dataType")="%String" then %dictionary(%DictNumber,"maxlen")=something
where something is the max len you want, Maybe
$get(%dictionary(%DictNumber,"width"),10)
then look for these and add the line after:
propRef->Parameters->SetAt("P","MVAUTO")
if $data(%dictionary(pord,"maxlen")) then propRef->Parameters->SetAt(%dictionary(pord,"maxlen"),"MAXLEN")
propRef->Parameters->SetAt(propRef->Parameters->GetAt("MVAUTO"):"P","MVAUTO")
if $data(%dictionary(pord,"maxlen")) then propRef->Parameters->SetAt(%dictionary(pord,"maxlen"),"MAXLEN")
IF COUNT(mva,"P") = 0 THEN propRef->Parameters->SetAt(mva:"P","MVAUTO")
if $data(%dictionary(pord,"maxlen")) then propRef->Parameters->SetAt(%dictionary(pord,"maxlen"),"MAXLEN")
then finally look for
IF $GET(%dictionary(pord,"width")) # propRef->Parameters->GetAt("MVWIDTH") THEN
propRef->Parameters->SetAt($GET(%dictionary(pord,"width")),"MVWIDTH")
END
and make a copy, replacing "width" and "MVWIDTH" with "maxlen" and "MAXLEN"
I think that covers what you need to do, but I could be missing something. Others may have a better idea.
On Feb 1, 2012, at 1:14 AM, Rich Brim wrote:
> Is it possible to get protoclass to set the MAXLEN in Class?
>
> Rich
>
class string properties default to a MAXLEN of 50 if you don’t specify one (PROTOCLASS doesn’t)
so yes, that is often not long enough