.NET Framework Bookmark and Share   
 index > Microsoft Codename 'Oslo' > Uppercase text pattern expression in mschema
 

Uppercase text pattern expression in mschema

The day has come, and i'm the one asking (for May CTP) :)

I'm having some trouble creating an uppercase validation in a type.

Type uppercase may have a length of max 30 characters and only letters in "A" .. "Z".

These are my attempts:

type uppercase : Text where value.Count < 30 && value in {"A","B","C", "D", "Z"}*;
Hoofdmodel.m(46,62-86) : error M3999:Not yet implemented: Expression 'TypeReference: Reference(PackageId:<null>,Name:<null>)' is not currently supported by the SQL expression generator

type uppercase : Text where value.Count < 30 && value in {"A" .. "Z"}*;
Hoofdmodel.m(46,67-69) : error M5007:Token ".." with text ".." unexpected.
Hoofdmodel.m(46,74-75) : error M5007:Token Asterisk with text "*" unexpected.

type uppercase : Text where value.Count < 30 && value in {"A", "B"};
Not what i want; it should be A, B ...*. or A, B ... 30.
(type uppercase : Text where value in {"A" .. "Z"}#30; )

Is it possible to validate something as being uppercase yet?
Are there workarounds?

Performing my Final Project, looking into codename "Oslo".
Elger [Centric]
Hi Elger, the following is another attempt:

module Upper
{
UpperCase:{ Content : Text#30 ;} where !(value.Content.Like('%[^A-Z]%'));

}

Unfortunately it will not reinforce the upper casing because of a case sensitivity bug. To work around this, you will have to install the following model and add some sql logic to alter the table as shown below:

module Upper
{
UpperCase:{ Content : Text#30 ;};

}

ALTER TABLE [Upper].[UpperCase]
ALTER COLUMN Content varchar(30) COLLATE Latin1_General_100_CS_AS_KS_WS -- Collation is case sensitive

ALTER TABLE [Upper].[UpperCase]
ADD CONSTRAINT [Check_Make] check(Content NOT LIKE N'%[^A-Z]%')


I hope this helps.


Thanks,

Stéphane

snyomba
Hi Elger, the following is another attempt:

module Upper
{
UpperCase:{ Content : Text#30 ;} where !(value.Content.Like('%[^A-Z]%'));

}

Unfortunately it will not reinforce the upper casing because of a case sensitivity bug. To work around this, you will have to install the following model and add some sql logic to alter the table as shown below:

module Upper
{
UpperCase:{ Content : Text#30 ;};

}

ALTER TABLE [Upper].[UpperCase]
ALTER COLUMN Content varchar(30) COLLATE Latin1_General_100_CS_AS_KS_WS -- Collation is case sensitive

ALTER TABLE [Upper].[UpperCase]
ADD CONSTRAINT [Check_Make] check(Content NOT LIKE N'%[^A-Z]%')


I hope this helps.


Thanks,

Stéphane

snyomba

You can use google to search for other answers

Custom Search

More Threads

• Accessing token descriptions from a DynamicParser
• MGrammar as foundation for an HTML Parser
• Cannot find an "Oslo" project template in Visual Studio 2010
• Is there any example on how to use the completion service in IntelliPad?
• Quadrant Software
• MGrammar control of function production
• Some breaking changes in January CTP
• Text Parsing with MGrammar
• How initialise record with "General" type field in "M"
• Oslo and the DSL Toolkit