TFS 2013 backslash in custom field - customization

I am trying to add a custom field in a work item template using TFS power tools. I add the new field and use the "ALLOWEDVALUES" rule to add some values. It allows me to put backslash character in the value field however when I try to save the work item, it throws an error: VS402504: User or group cannot be found: Category\SubCategory. Verify that the users and groups used in your work item type definition exist.
I could find a way to escape the backslash character. Is it not possible to put backslash characters in custom fields?

The backslash is supported in the filed value.
ALLOWEDVALUES Defines a list of allowed values for the field. Allowed values are values that are available for selection in a field
list on work item forms and in the query builder. You must select from
one of these values.
Note: When you use ALLOWEDVALUES to define a list of values that users can specify in a work item form or the query editor. Users must specify one of the values in the GLOBALLIST or the set of LISTITEM entries.
A sample of value for your reference:
<LISTITEM value="Emergency"/>
<LISTITEM value="Major"/>
<LISTITEM value="Minor"/>
<LISTITEM value="Domain\joe"/>
<LISTITEM value="[Global]\GlobalGroup" />
<LISTITEM value="[Project]\ProjectGroup" />
More details about related info please take a look at official tutorial: Define pick lists
For field pattern value: ^[a-zA-Z_][a-zA-Z0-9_]*(\.[a-zA-Z0-9_]+)+$, also check the field definition here.
Update:
If the field value contain backslash(\) characters, it will be parsed to an IdentityName(account) by default. As a workaround, you could try to use / instead. Take a look at this similar question: Is there any way to use a backslash in a TFS Global List value?

Related

Django: display a preview of an object's attribute - Class based views

Using a ListView Class-based-view, I am looping over the objects present in the database of a certain model in my HTML template, and, for instance, I can access an object's "body_text" attribute with the following syntax: {{object.body_text}}
What if I wanted to only show the first 20 characters of that "body_text" attribute in my HTML template?
How can I set that?
1st Method
Use the truncatechars filter in your HTML template.Truncates a string if it is longer than the specified number of characters. Truncated strings will end with a translatable ellipsis character (“…”).
{{object.body_text|truncatechars:20}}
Reference:
https://docs.djangoproject.com/en/dev/ref/templates/builtins/?from=olddocs#truncatechars
2nd Method
Use the slice filter in your HTML template.
{{object.body_text|slice:":20"}}
Referernce: https://docs.djangoproject.com/en/dev/ref/templates/builtins/#slice
Found it, eventually.
Use the |slice:":" filter in your HTML template.
For example, if you only want to display the first 10 characters of a given attribute, use:
{{object.body_text|slice:":10"}}

Save substring from field to copyfield using regex in Solr

I'm importing data from mysql table using import handler. I have a column msg, of type text. Using regex, I have to save substring in a copy field.
msg: 94eb2c0cb17ef354bb052c57f40c\r\nContent-Type: text/plain; charset=UTF-8\r\nContent-Transfer-Encoding pnr:986|0978325
Expected Solr result:
{
"msg_body": "94eb2c0cb17ef354bb052c57f40c\\r\\nContent-Type: text/plain; charset=UTF-8\\r\\nContent-Transfer-Encoding pnr:986-0978325",
"pnr_number": "pnr:986-0978325"
}
My REGEX:
(pnr|(P|p)[ _.:,!"'-/$](N|n)[ _.:,!"'-/$](R|r))+[ _.:,!"'-/$]+[0-9]{3}[ _.:,!"'-/$]+[0-9]{7}
Please help me out as i'm new to solr
You'll need to define a custom field for pnr_number.
Use a copyField to copy msg_body to pnr_number
In the custom field definition, use
<filter class="solr.PatternCaptureGroupFilterFactory" pattern="regex goes here" preserve_original="false"/>
Since you are using Data Import Handler, you have 3 options:
Use a Regex Transformer in DIH definition.
Use a RegexReplaceProcessorFactory Update Request Processor (in solrconfig.xml).
Use a Regex filter in the analyzer chain
With the first two options, the regex will extract the pattern before the field is actually indexed. In the last option, the stored representation (if you store the field) will contain the original full string, but the indexed (searchable) representation will contain regex match.

Enterprise Architect document creation - filter

Enterprise Architect was introduced to me only today, and i also got a task related to document generation, which should be done as soon as possible.
I have to write a template for doc generation, and this template should do some filtering or conditioning on a specific element.
From a closer look: I have an element, which has a special field {Element.SpecialField}, that can hold values of true or fase. If the field's value is true, then the field's name should be generated into the doc, else nothing.
Which is the easiest way to do this? Scripting or selector/fragment filters? Thanks.
EDIT:
The generated document should look something like this:
![EA Document]: http://s29.postimg.org/68edfthdz/EA_doc.jpg
The cells containing question marks are the specific element values I mentioned above the EDIT section.
There are three element fields: TagValue_X, TagValue_Y and TagValue_Z.
They can be true or "" (empty string) individually.
But in the table cell I don't want to see their values, but the names of the fields separated by commas. For example: if
{Element.valueOf(X)} == true AND {Element.valueOf(Y)} == "" AND {Element.valueOf(Z)} == true
, then the cell should contain "X, , Z".
EDIT 2: To Geert's answer.
The following script works well, when I want to to search in the Model (CTRL+ALT+A in EA 12):
SELECT t_objectproperties.Property FROM t_object, t_objectproperties
WHERE t_objectproperties.Value='True'
AND t_objectproperties.Property='X'
AND t_object.Object_ID = t_objectproperties.Object_ID
How should I modify this to apply it as a Custom Query in the fragment template? I tried some queries like this, but they never returned anything. Probably this is a basic conceptual misunderstanding issue from me...
SELECT t_objectproperties.Property AS SomeQuery
FROM t_objectproperties
WHERE t_objectproperties.Value='True'
AND t_objectproperties.Property='X'
AND t_objectproperties.Object_ID = #OBJECTID#
TemplateMain:
package>
element>
{Template - TemplateFragment}
<element
<package
TemplateFragment:
custom>
{SomeQuery}
<custom
I suppose the fragment template should be inserted into the element section.
The easiest solution would be to create an SQL fragment.
Using SQL you can return exactly the fields you need based on the PackageID passed to the template fragment.
Check the learning center (Alt-F1) for a step-by-step guide on creating SQL fragments.

Need to exclude field values from Sitecore search index viewer is not working

I need to eliminate/exclude a field id/value in config. This is what I have in my config but still it's not eliminating my field id. I need help to eliminate/exclude the field values in Sitecore.
<include hint="list:ExcludeField">
<fieldId>{A0CB3965-8884-4C7A-8815-B6B2E5CED162}</fieldId> </include>
I need help excluding the field value and finding a field id for the ones in image.
In detail, how do I exclude all the highlighted ones from index search?
To find Field Guid go to template manager and select the template which has your field. Then expand the tree to find FieldItem and grab Field Guid from FieldItem's quick info section.

Create Template Custom Field Field in Sitecore

I want add a custom field in a Sitecore template.
Field will be a drop down of hours (1 -23) and used to show open and close time.
Ex: 8am to 7pm.
How can I add a custom field for that?
You can use a droplist field and set it's datasource to a folder that contains numbered items 1-23.
You could also just use a plain text field and optionally add a validator, or a date-time field if you actually want the time (+date) formatted.