TFS WorkItem Layout problem - layout

I'm customizing a TFS Work Item Type, adding a 'Business Description' HTML Field, but I cannot get the Layout right:
<Tab Label="Details">
<Group>
<Column PercentWidth="60">
<Control FieldName="Customer.BusinessDescription" Type="HtmlFieldControl" Label="Business Description:" LabelPosition="Top" Dock="Fill" />
</Column>
<Column PercentWidth="40">
<Control FieldName="Microsoft.VSTS.CMMI.Symptom" Type="HtmlFieldControl" Label="Symptom:" LabelPosition="Top" />
<Control FieldName="System.History" Type="WorkItemLogControl" Label="&History:" LabelPosition="Top" />
</Column>
</Group>
</Tab>
This turns out like this:
While I really want this ('Photoshopped' with MSPaint):
I have played around with the Fill properties on all three fields, have already set the MinimumSize property on the BusinessDescription field, added a group inside the left column, but I do not seem to find a solution for this.
Is this at all possible?

You'll want to create a group inside both the left and right columns:
<Tab Label="Details">
<Group>
<Column PercentWidth="60">
<Group>
<Column PercentWidth="100">
<Control FieldName="Customer.BusinessDescription" Type="HtmlFieldControl" Label="Business Description:" LabelPosition="Top" Dock="Fill" />
</Column>
</Group>
</Column>
<Column PercentWidth="40">
<Group>
<Column PercentWidth="100">
<Control FieldName="Microsoft.VSTS.CMMI.Symptom" Type="HtmlFieldControl" Label="Symptom:" LabelPosition="Top" />
<Control FieldName="System.History" Type="WorkItemLogControl" Label="&History:" LabelPosition="Top" />
</Column>
</Group>
</Column>
</Group>
</Tab>
You may also want to check out the Process Editor Power Tool - this provides a GUI interface to editing work item types.

Related

XSLT - parse date and time

I am attempting to set the Type attribute of a cell in Excel via XSL. It should look at report/sheet/definition/column and see if there's a type attribute. If yes, it should set the Cell Type to that type and format it in full time (or datetime) manner.
My xml data:
<report>
<sheet>
<definition>
<columns>
<column name="Code" footerText="ISO Code" width="80" />
<column name="Time" footerText="Time" format="DateTime" width="58" type="DateTime" />
<column name="Country" footerText="Country" width="100" />
<column name="SomeNumber" footerText="Country" width="100" type="Number"/>
</columns>
</definition>
<data>
<table>
<row>
<column value="2020-04-02" key="DATE" />
</row>
<row>
<column value="123" />
<column value="10:30" />
<column value="Belarus" />
<column value="0" />
</row>
<row>
<column value="321" />
<column value="12:00" />
<column value="Austria" />
<column value="0" />
</row>
<row>
<column value="2020-04-03" key="DATE" />
</row>
<row>
<column value="456" />
<column value="08:00" />
<column value="USA" />
<column value="24" />
</row>
</table>
</data>
</sheet>
</report>
I have tried printing out $type and $index in the cell and they truly print out properly, but when I try to take the value of $type and use for <xsl:attribute name="ss:Type">, Excel provides me with an error saying it had problems during the load. After checking out the logs, it turns out that it can't parse values like 12:00 into a Time (or shall I say DateTime?). I have two questions:
Is that expected behavior that it can't parse timespan values into DateTime?
Is it normal behavior that it can't parse 2020-01-01 as DateTime as well?
<xsl:for-each select="data/table/row">
<ss:Row>
<xsl:variable name="set" select="column" />
<xsl:variable name="count" select="count($set)"/>
<xsl:for-each select="column">
<ss:Cell>
<xsl:variable name="index" select="position()"/>
<xsl:variable name="type" select="../../../definition/columns/column[$index]/#type"/>
<xsl:attribute name="ss:MergeAcross">
<xsl:choose>
<xsl:when test="$count>1">
<xsl:value-of select="0"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$mergeAcrossHeader"/>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<ss:Data>
<xsl:attribute name="ss:Type">
<xsl:choose>
<xsl:when test="$type!=''">
<xsl:value-of select="$type" />
</xsl:when>
<xsl:otherwise>
<xsl:text>String</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:value-of select="#value" />
</ss:Data>
</ss:Cell>
</xsl:for-each>
</ss:Row>
</xsl:for-each>

Liferay Service Builder Table Auto Increment On Each Deployment

In liferay i have a entity as below:
<entity name="Foo" local-service="true" remote-service="true">
<!-- PK fields -->
<column name="fooId" type="long" primary="true" />
<!-- Group instance -->
<column name="groupId" type="long" />
<!-- Audit fields -->
<column name="companyId" type="long" />
<column name="userId" type="long" />
<column name="userName" type="String" />
<column name="createDate" type="Date" />
<column name="modifiedDate" type="Date" />
<!-- Other fields -->
<column name="field1" type="String" />
<column name="field2" type="boolean" />
<column name="field3" type="int" />
<column name="field4" type="Date" />
<column name="field5" type="String" />
<!-- Order -->
<order by="asc">
<order-column name="field1" />
</order>
<!-- Finder methods -->
<finder name="Field2" return-type="Collection">
<finder-column name="field2" />
</finder>
</entity>
When i change the code of the portlet. On each deployment its primary key increases by 100.
So there is anyway to set it auto increment by 1 only. And it must not be incremented by 100 on each deploy.
Option#1
Add this in your primary key column id-type="increment"
i.e
<column name="fooId" type="long" primary="true" id-type="increment" />
Cons:
This WILL BREAK IN CLUSTERED Environment
Option#2
add this in portal-ext.properties
#
# Set the number of increments between database updates to the Counter
# table. Set this value to a higher number for better performance.
#
counter.increment=1 //by default it is 100
Cons: this will impact your performance.

Automatic generation of header p:columnGroup of p:dataTable

This question is about p:dataTable header manipulation.
I want to find a way to manipulate the header p:dataTable (primefaces) from java code directly, to make something like this:
<p:dataTable id="genericReport" value="#{mb.lazyData}" >
<!-- header -->
<p:columnGroup type="header" binding="#{mb.header}" >
</p:columnGroup>
<!-- some data -->
<p:column>
<h:outputText value="..." />
</p:column>
</p:dataTable>
Where #{mb.header}" is a java code read from a XML, manipulated by a tree through XPath.
I want to do this because I have a lot of reports with a complex header; I mean, diferents levels, diferents conbination of cells.
UPDATE
The header could be with a lot of rows, not only one. Here is an example of a a table.
This header has to be generated by an xml configuration. Here is the XML.
<header id="report">
<column text="Granpa Pather">
<column text="Pather 1">
<column text="Child 1">
<column text="Grand Child 1" />
<column text="Grand Child 2" />
</column>
<column text="Child 2" />
<column text="Child 3" />
</column>
<column text="Pather 2">
<column text="Child 4" />
<column text="Child 5" />
</column>
<column text="Pather 3">
<column text="Child 6" />
<column text="Child 7" />
<column text="Child 8" />
</column>
</column>
</encabezado
The colspan and rowspan is calculated by tree theory, it is not the problem.
I achievement to do this in a PDF y XLS (Itext and ApachePOI, respectly), using XPath and tree manipulation. My problem here is that HTML it is not so easy to manipulate. I think it could be to make using the API Primefaces.

FetchXML View to Include Attributes from Nested Link-Entity

I would like to have a view that show attributes from 3 entities:
Statistics has a lookup to Account and Account has a lookup to Address.
The view is on Statistics and I want attributes from all 3 entities; is this even possible?
The problem is with the GridXML.
I want to include the attribute wl_city in the GridXML.
This is the FetchXML with link-entities:
<fetchxml>
<fetch version="1.0" output-format="xml-platform" mapping="logical">
<entity name="sb_statistics">
<order attribute="sb_amount" descending="false" />
<!-- It is easy to get these into the GridXML -->
<attribute name="sb_debtor" />
<attribute name="sb_date" />
<attribute name="sb_amount" />
<link-entity name="account" from="accountid" to="sb_debtor"
alias="relatedAccount" link-type="outer">
<!-- It is possible to get this into the GridXML
by using the link-entity alias: relatedAccount.wl_towncity -->
<attribute name="wl_towncity" />
<link-entity name="wl_postalcode" from="wl_postalcodeid"
to="wl_postaltowncity" alias="relatedAddress" link-type="outer">
<!-- I have trouble getting this attribute into the GridXML -->
<attribute name="wl_city" />
</link-entity>
</link-entity>
<attribute name="sb_statisticsid" />
</entity>
</fetch>
</fetchxml>
When I change the GridXML as below this error is displayed when the view is opened:
"To use this saved query, you must remove criteria and columns that refer to deleted or non-searchable items"
<layoutxml>
<grid name="resultset" object="10008" jump="sb_name" select="1" preview="1"
icon="1">
<row name="result" id="sb_statisticsid" multiobjectidfield="1">
<cell name="sb_amount" width="100" />
<cell name="sb_date" width="100" />
<cell name="sb_debtor" width="100" />
<cell name="relatedAccount.relatedAddress.wl_city" width="100" />
</row>
</grid>
</layoutxml>
The below GridXML shows this error when the view is opened:
"Unexpected Error An error has occured".
<layoutxml>
<grid name="resultset" object="10008" jump="sb_name" select="1" preview="1"
icon="1">
<row name="result" id="sb_statisticsid" multiobjectidfield="1">
<cell name="sb_amount" width="100" />
<cell name="sb_date" width="100" />
<cell name="sb_debtor" width="100" />
<cell name="relatedAddress.wl_city" width="100" />
</row>
</grid>
</layoutxml>
The GridXML below results in this error being shown when the view is opened:
"To use this saved view, you must remove criteria and columns that refer to deleted or non-searchable columns".
<layoutxml>
<grid name="resultset" object="10008" jump="sb_name" select="1" preview="1"
icon="1">
<row name="result" id="sb_statisticsid" multiobjectidfield="1">
<cell name="sb_amount" width="100" />
<cell name="sb_date" width="100" />
<cell name="sb_debtor" width="100" />
<cell name="wl_city" width="100" />
</row>
</grid>
</layoutxml>
This saved query works, but it only includes attributes from the primary entity and the first link-entity.
<savedquery>
<IsCustomizable>1</IsCustomizable>
<CanBeDeleted>0</CanBeDeleted>
<isquickfindquery>0</isquickfindquery>
<isprivate>0</isprivate>
<isdefault>0</isdefault>
<returnedtypecode>10008</returnedtypecode>
<savedqueryid>{df101ac4-2e4d-e311-9377-005056bd0001}</savedqueryid>
<layoutxml>
<grid name="resultset" object="10008" jump="sb_name" select="1" preview="1"
icon="1">
<row name="result" id="sb_statisticsid" multiobjectidfield="1">
<cell name="sb_amount" width="100" />
<cell name="sb_date" width="100" />
<cell name="sb_debtor" width="100" />
<cell name="relatedAccount.wl_city" width="100" />
</row>
</grid>
</layoutxml>
<querytype>0</querytype>
<fetchxml>
<fetch version="1.0" output-format="xml-platform" mapping="logical">
<entity name="sb_statistics">
<order attribute="sb_amount" descending="false" />
<attribute name="sb_debtor" />
<attribute name="sb_date" />
<attribute name="sb_amount" />
<link-entity name="account" from="accountid" to="sb_debtor"
alias="relatedAccount" link-type="outer">
<attribute name="wl_towncity" />
<link-entity name="wl_postalcode" from="wl_postalcodeid"
to="wl_postaltowncity" alias="relatedAddress" link-type="outer">
<attribute name="wl_city" />
</link-entity>
</link-entity>
<attribute name="sb_statisticsid" />
</entity>
</fetch>
</fetchxml>
<LocalizedNames>
<LocalizedName description="Statistics and Address" languagecode="1033" />
</LocalizedNames>
</savedquery>
Is GridXML limited to showing only attributes from the primary entity and the first link-entity?
This is not possible, according to the best of my knowledge, but please someone prove me wrong.
A limitation of GridXML appears to be that attributes can only be included that are from the first link-entity, not any nested link-entities.
It should work when using link-type="inner" for nested link.
<entity name="sb_statistics">
...
<link-entity name="account" from="accountid" to="sb_debtor"
alias="relatedAccount" link-type="outer">
<attribute name="wl_towncity" />
<link-entity name="wl_postalcode" from="wl_postalcodeid"
to="wl_postaltowncity" alias="relatedAddress" link-type="inner"> //link-type="inner"
<attribute name="wl_city" />
</link-entity>
</link-entity>
<attribute name="sb_statisticsid" />
</entity>
I have found no evidence that it can be done. With or without link-type='inner' the designer (in 2013) says, "The relatedAddress.wl_city column is no longer a valid column because it has been deleted as a column option. You need to remove this column and, if you want, add a different one."
It does NOT need multiple dereferrences, nor does that work. If you dump the keyValuePairs of the AttributeCollection returned by the fetch, you will see the key is relatedAddress.w1_city -- not its parent nor the combination.
Like the UI, it just appears the layout is limited to only root and children, no grandchildren nor further descendants.
I think it's a little late to answer this question, but maybe someone come to this post and find it helpful.
first thing you should know is that, fetchxml will return only column that are not null, so if you are querying a column that there is no data in that, then fetchxml automatically remove it from result set.
second thing is, if you have different table with different relationship, then alias name will be added to the column name, so in your case relatedAccount.wl_towncity and relatedAddress.wl_city is correct and not relatedAccount.relatedAddress.wl_city. in your example, you put alias name after each other that is not correct.
third thing that you should know is that when a nested result will return, the type is object, but original type AliasedValue , so first you have to cast the object to AliasedValue. then it become ready to cast it to OptionSetValue. after that you have to look for .Value that has the result of what you want
I made it work like this: I still have an issue with unresolved columnheaders.
<fetch distinct='true'>
<entity name='rdiac_riskobject'>
<attribute name='rdiac_riskobjectid' />
<attribute name='rdiac_name' />
<attribute name='rdiac_riskobjectproduct' />
<link-entity name='rdiac_riskobject_rdiac_propertydetail' from='rdiac_riskobjectid' to='rdiac_riskobjectid' intersect='true'>
<link-entity name='rdiac_propertydetail' alias='pd1' from='rdiac_propertydetailid' to='rdiac_propertydetailid'>
<attribute name='rdiac_valuestring' />
<link-entity name='rdiac_propertysvconfig' from='rdiac_property' to='rdiac_propertyid'>
<filter>
<condition attribute='rdiac_svfield' operator='eq' value='100000000'/>
</filter>
</link-entity>
</link-entity>
</link-entity>
<link-entity name='rdiac_riskobject_rdiac_propertydetail' from='rdiac_riskobjectid' to='rdiac_riskobjectid' intersect='true'>
<link-entity name='rdiac_propertydetail' alias='pd2' from='rdiac_propertydetailid' to='rdiac_propertydetailid'>
<attribute name='rdiac_valuestring' />
<link-entity name='rdiac_propertysvconfig' from='rdiac_property' to='rdiac_propertyid'>
<filter>
<condition attribute='rdiac_svfield' operator='eq' value='100000001'/>
</filter>
</link-entity>
</link-entity>
</link-entity>
</entity>
</fetch>
<grid name='resultset' object='10139' jump='rdiac_riskobjectproduct' select='1' preview='0' icon='1' >
<row name='result' id='rdiac_riskobjectid' >
<cell name='rdiac_riskobjectproduct' width='100' />
<cell name='pd1.rdiac_valuestring' width='200' />
<cell name='pd2.rdiac_valuestring' width='200' />
</row>
</grid>

Invalidate doesn't hide tabs

I am trying to push the limits of my understanding of the Fluent Ribbon/RibbonUI system in the Office 2007/2010 framework.
Coupling that with my knowledge and understanding of XAML design for WPF/Silverlight, i wanted to see if i could dynamically show/hide the described Office Menu items below and it seems i have FUBAR'd something up.
Please advise where i went wrong, or where i need to further develop:
CustomUI.xml
<group id="grpITOfficeMenu"
label="Office Menu">
<button id="btnShowOffice"
label="Show"
onAction="ShowOfficeTabs"/>
<button id="btnHideOffice"
label="Hide"
onAction="HideOfficeTabs" />
</group>
<group id="grpITContextualTabs"
label="Contextual Tabs" >
<button id="btnShowContext"
label="Show"
onAction="ShowContextualTabs"/>
<button id="btnHideContext"
label="Hide"
onAction="HideContextualTabs"/>
</group>
...
<officeMenu>
<button idMso="FileNew"
getVisible="OfficeGetVisible" />
<button idMso="FileOpen"
getVisible="OfficeGetVisible" />
</officeMenu>
<contextualTabs>
<tabSet idMso="TabSetSmartArtTools"
getVisible="ContextualGetVisible" />
<tabSet idMso="TabSetChartTools"
getVisible="ContextualGetVisible"/>
<tabSet idMso="TabSetDrawingTools"
getVisible="ContextualGetVisible" />
<tabSet idMso="TabSetPictureTools"
getVisible="ContextualGetVisible" />
<tabSet idMso="TabSetPivotTableTools"
getVisible="ContextualGetVisible" />
<tabSet idMso="TabSetHeaderAndFooterTools"
getVisible="ContextualGetVisible" />
<tabSet idMso="TabSetTableToolsExcel"
getVisible="ContextualGetVisible" />
<tabSet idMso="TabSetPivotChartTools"
getVisible="ContextualGetVisible" />
<tabSet idMso="TabSetInkTools"
getVisible="ContextualGetVisible" />
</contextualTabs>
VBA:
'Method to Refresh the RibbonUI object
Sub RefreshRibbon(tag As String)
'Check if Ribbon variable has been initialized with Ribbon Object from Excel
If Not (Rib Is Nothing) Then
'Ribbon variable has been initialized.
MyTag = tag
Rib.Invalidate
End If
End Sub
'Flip OfficeMenu Tabs visible based on #OffVisible value
Sub OfficeGetVisible(control As IRibbonControl, ByRef returnVal)
returnVal = OffVisible
End Sub
'Flip Contextual Tabs visible based on #ContVisible value
Sub ContextualGetVisible(control As IRibbonControl, ByRef returnVal)
returnVal = ContVisible
End Sub
...
'Show/Hide ContextualTabs in the IT Mode
Sub ShowContextualTabs(Optional ctrl As Variant)
ContVisible = True
RefreshRibbon tag:=MyTag
End Sub
Sub HideContextualTabs(Optional ctrl As Variant)
ContVisible = False
RefreshRibbon tag:=MyTag
End Sub
'Show/Hide OfficeMenu Tabs in the IT Mode
Sub ShowOfficeTabs(Optional ctrl As Variant)
OffVisible = True
RefreshRibbon tag:=MyTag
End Sub
Sub HideOfficeTabs(Optional ctrl As Variant)
OffVisible = False
RefreshRibbon tag:=MyTag
End Sub
Update:
Did some detailed testing and it technically works, but what I am trying to ultimately have completed is the ability to show/hide Home, Insert, Page Layout, Formulas, Data, Review, View, Developer, etc. tabs from the ribbon. I'm trying to remove the need, or necessity, of the startfromscratch attribute in the customui element.
Got it solved, had to go look at ALL of the idMso values for both TabSets & Tab objects in the Ribbon.
So here is the XML for the CustomUI to allow for Show/Hide of some of the Default (at least the ones i needed) Tab/TabSet's. Using the same Show/Hide methods above.
<customUI onLoad="s_UIOnLoad" xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon>
<!-- Excel File Menu options, not available through Tab or TabSets -->
<officeMenu>
<button idMso="FileNew" getVisible="OfficeGetVisible" />
<button idMso="FileOpen" getVisible="OfficeGetVisible" />
</officeMenu>
<!-- Excel TabSets that only become visible when certain objects
are selected (such as ListObjects, PivotTables, Charts, etc) -->
<contextualTabs>
<tabSet idMso="TabSetChartTools" getVisible="ContextualGetVisible"/>
<tabSet idMso="TabSetDrawingTools" getVisible="ContextualGetVisible" />
<tabSet idMso="TabSetEquationTools" getVisible="ContextualGetVisible" />
<tabSet idMso="TabSetHeaderAndFooterTools" getVisible="ContextualGetVisible" />
<tabSet idMso="TabSetInkTools" getVisible="ContextualGetVisible" />
<tabSet idMso="TabSetPictureTools" getVisible="ContextualGetVisible" />
<tabSet idMso="TabSetPivotChartTools" getVisible="ContextualGetVisible" />
<tabSet idMso="TabSetPivotTableTools" getVisible="ContextualGetVisible" />
<tabSet idMso="TabSetSlicerTools" getVisible="ContextualGetVisible" />
<tabSet idMso="TabSetSmartArtTools" getVisible="ContextualGetVisible" />
<tabSet idMso="TabSetSparkline" getVisible="ContextualGetVisible" />
<tabSet idMso="TabSetTableToolsExcel" getVisible="ContextualGetVisible" />
</contextualTabs>
<tabs>
<!-- Excel Menu Tabs, these are not included in the TabSets and
must be explicitely defined -->
<tab idMso="TabAddIns" getVisible="OfficeGetVisible" />
<tab idMso="TabBackgroundRemoval" getVisible="OfficeGetVisible" />
<tab idMso="TabData" getVisible="OfficeGetVisible" />
<tab idMso="TabDeveloper" getVisible="OfficeGetVisible" />
<tab idMso="TabFormulas" getVisible="OfficeGetVisible" />
<tab idMso="TabHome" getVisible="OfficeGetVisible" />
<tab idMso="TabInsert" getVisible="OfficeGetVisible" />
<tab idMso="TabPageLayoutExcel" getVisible="OfficeGetVisible" />
<tab idMso="TabReview" getVisible="OfficeGetVisible" />
<tab idMso="TabView" getVisible="OfficeGetVisible" />
...
</tabs>
</ribbon>
</customUI>
Start from Scratch
<?xml version="1.0" encoding="UTF-8"?>
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load">
<ribbon startFromScratch="true"/>
</customUI>
It removes everything but the backstage.
and if you want to bring some of them back
<?xml version="1.0" encoding="UTF-8"?>
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load">
<ribbon startFromScratch="true">
<tabs>
<tab idMso="TabView" visible="true"/>
</tabs>
</ribbon>
</customUI>

Resources