Documentation describes possibility to do regexp constraints:
ALTER PROPERTY Account.gender REGEXP "[M|F]"
I always receive exception:
com.orientechnologies.orient.core.command.OCommandExecutorNotFoundException:
Cannot find a command executor for the command request: ...
Every other thing works. Did you have this problem? How did you fix it? Should I create an issue?
EDIT:
I use version 2.2.18. I was trying to execute this code:
CREATE CLASS Account extends V;
CREATE PROPERTY Account.Gender STRING (MANDATORY TRUE, MAX 20, REGEXP "[M|F]");
I also don't see regexp option when inspecting scheme in studio. There is everything else: mandatory, read only, not null, min, max, collate, etc... but no regexp.
Did you create the Account class and the gender property before doing this request?
This is working :
CREATE CLASS Account extends V
CREATE PROPERTY Account.gender STRING
ALTER PROPERTY Account.gender REGEXP "M|F"
EDIT :
You actually can't do it in one request (you need to alter the property to add regexp) I don't think it's normal so you can create an issue.
Hope it helps
Related
I'm trying to use the drift library (renamed from moor) ,but it's unable to create tables because of this error:
SqliteException(1): parameters prohibited in CHECK constraints, SQL logic error (code 1)
CREATE TABLE IF NOT EXISTS enterprise (name TEXT NOT NULL CHECK(LENGTH(name) <= ?), ..other fields);
This is the table class causing the error:
class Enterprise extends Table {
TextColumn get name =>
text().check(name.length.isSmallerOrEqualValue(maxNameLength))();
// ...other fields
}
The error goes away if I remove the check. Could someone explain why the check isn't working ?
Turns out it's a bug with drift. This is the workaround as suggested by the author of drift, and will be fixed in a future release.
Replace
check(name.length.isSmallerOrEqualValue(maxNameLength))
With this:
check(name.length.isSmallerOrEqual(Constant(maxNameLength)))
I would like to select a customer from the select box by start typing its phone number.
How can I do that?
I have seen some are using name_search method.But still i am confused how to use it in both front end and back end.
Or is there any other solution for this.
Override the name_search method of your model and the domain you want on the args variable. Take a look at addons/account/account.py around line 595 args += [('type', '=', type)] for a concrete implementation. Make sure that you return the appropriate data structure as documented in the method's docstring at openerp/models.py.
For Auto complete in odoo. It provides suggestion only in case of using Many2one field in any module.
If you want to show suggestion and autocomplete. Create a model to store the mobile numbers and then use that particular model as foreign key in existing model.
That will do for you.
In MSDN article
Deprecated Database Engine Features in SQL Server 2016
there is a statement on deprecation of DEFAULT keyword (among the others).
Quoted from the table:
Category: Transact-SQL
Deprecated feature: Use of DEFAULT keyword as default value.
Replacement: Do not use the word DEFAULT as a default value.
Feature name: DEFAULT keyword as a default value.
Feature ID: 187.
What is the logic behind this change? I find nothing wrong with
CREATE FUNCTION dbo.GetFirstIdByCode(#Code nvarchar(20), #ExcludeThisId int)
and in most cases, where I don't use 2nd parameter, call it like
IF dbo.GetFirstIdByCode(#Id, DEFAULT) = 0 --- etc...
Of course, I can replace DEFAULT with NULL at every call of the function. To me, this looks like anything but a progress. Why is this planned?
How should I adjust my coding style preparing for this?
The wording was incorrect:Erland raised a connect item for this..please see this connect for more details..
Pasting relevant items from connect item:
Depreceated feature is ..
using the word DEFAULT as the DEFAULT value.
Example:
CREATE TABLE T1
(Col1 int PRIMARY KEY,
Status varchar(10) DEFAULT 'DEFAULT' )
or
CREATE DEFAULT phonedflt AS 'DEFAULT'
I had been developing some base queries for about 6 months prior to the release of 2.2
CREATE CLASS Flag_Definitions EXTENDS V
CREATE PROPERTY Flag_Definitions.V_status EMBEDDEDMAP STRING
CREATE PROPERTY Flag_Definitions.V_branding EMBEDDEDMAP STRING
CREATE PROPERTY Flag_Definitions.Block_type EMBEDDEDMAP STRING
CREATE VERTEX Flag_Definitions SET title = "developer reference for all data flags", V_status = {"ACTIVE":"Normal active record", "SUSPENDED":"Currently inactive record","DELETED":"Discontinued record maintained for archiving"}, Block_type = {"Prop":"Holds text from a data object property","HTML":"Holds basic HTML for content","Container":"Holds other blocks"}
but now I'm getting this error in studio
{"errors":[{"code":400,"reason":400,"content":"Map found but entries are not defined as :\r\n\tDB name=\"TestDB\""}]}
From console, the phrasing is slightly different
Map found but entries are not defined as <key>:<value>
Either way, the format 'SET mapfield = {"key":"val"}' no longer seems to be working, and I can't find an explanation. I even looked into the orient code on github (line 118), but, having 2 parts, the format should be passing the check on line 117.
Solved this one, it has nothing to do with the Flag_Definitions object, but I had a default status flag being applied to all created vertices
CREATE PROPERTY V.flags EMBEDDEDMAP STRING
ALTER PROPERTY V.flags DEFAULT {"status":"ACTIVE"}
The issue is the DEFAULT, which needs to be
DEFAULT '{"status":"ACTIVE"}'
Similarly, I had to change
DEFAULT sysdate() to DEFAULT "sysdate()"
I'm using a plugin and want to perform an action based on the records statuscode value. I've seen online that you can use entity.FormattedValues["statuscode"] to get values from option sets but when try it I get an error saying "The given key was not present in the dictionary".
I know this can happen when the plugin cant find the change for the field you're looking for, but i've already checked that this does exist using entity.Contains("statuscode") and it passes by that fine but still hits this error.
Can anyone help me figure out why its failing?
Thanks
I've not seen the entity.FormattedValues before.
I usually use the entity.Attributes, e.g. entity.Attributes["statuscode"].
MSDN
Edit
Crm wraps many of the values in objects which hold additional information, in this case statuscode uses the OptionSetValue, so to get the value you need to:
((OptionSetValue)entity.Attributes["statuscode"]).Value
This will return a number, as this is the underlying value in Crm.
If you open up the customisation options in Crm, you will usually (some system fields are locked down) be able to see the label and value for each option.
If you need the label, you could either do some hardcoding based on the information in Crm.
Or you could retrieve it from the metadata services as described here.
To avoid your error, you need to check the collection you wish to use (rather than the Attributes collection):
if (entity.FormattedValues.Contains("statuscode")){
var myStatusCode = entity.FormattedValues["statuscode"];
}
However although the SDK fails to confirm this, I suspect that FormattedValues are only ever present for numeric or currency attributes. (Part-speculation on my part though).
entity.FormattedValues work only for string display value.
For example you have an optionset with display names as 1, 2, 3,
The above statement do not recognize these values because those are integers. If You have seen the exact defintion of formatted values in the below link
http://msdn.microsoft.com/en-in/library/microsoft.xrm.sdk.formattedvaluecollection.aspx
you will find this statement is valid for only string display values. If you try to use this statement with Integer values it will throw key not found in dictionary exception.
So try to avoid this statement for retrieving integer display name optionset in your code.
Try this
string Title = (bool)entity.Attributes.Contains("title") ? entity.FormattedValues["title"].ToString() : "";
When you are talking about Option set, you have value and label. What this will give you is the label. '?' will make sure that the null value is never passed.