Inserting parameters into a template loop - bi-publisher

Is it possible to use the parameters declared in the parameters' node (see the XDT file) inside a foreach loop in the template? I'd have to add a namespace? If yes which one?
File XDT:
<dataTemplate name="StoreLayoutLabels" xmlns="http://micros.com/xstore/config/report">
<labels>
<!-- Template-specific Text -->
<label name="HANDHELD_READ" value="_art.inventory.handheld.read"/>
<label name="MANUAL_CHECK" value="_art.inventory.manual.check"/>
<label name="OPERATOR1" value="_art.inventory.operator1"/>
<label name="OPERATOR2" value="_art.inventory.operator2"/>
<label name="SECTION" value="_art.inventory.section"/>
<label name="STORE" value="_art.inventory.store"/>
</labels>
<parameters>
<!-- System Parameters -->
<parameter name="GroupName" class="java.lang.String" isForPrompting="false" include_in_output="true"/>
<parameter name="storeNbr" class="java.lang.String" isForPrompting="false" include_in_output="true"/>
<parameter name="storeName" class="java.lang.String" isForPrompting="false" include_in_output="true"/>
</parameters>
<!--Data source and data Structure-->
<dataSource>
<dataReference name="Q_STORE_LAYOUT_LABELS">
<ResultFields>
<ResultField>SectionId</ResultField>
<ResultField>SectionDescription</ResultField>
</ResultFields>
</dataReference>
</dataSource>
<dataStructure>
<group name="STORE_LAYOUT_LABELS" source="Q_STORE_LAYOUT_LABELS">
<element name="SECTION_ID" value="SectionId"/>
<element name="SECTION_DESCRIPTION" value="SectionDescription"/>
</group>
</dataStructure>
</dataTemplate>
Report template:
For example, PAR_GROUP_NAME is represented by the <?GroupName?> tag in the template but it doesn't appear after the PDF transformation. The value is shown correctly if the tag is inserted outside the label F which represents the loop.

When you reference a field, it's looking inside the element you are currently in. So you will need to tell BI Publisher where it is if it's not in the current element. Just add ../ for each level you need to go up the tree, and then once you get into the first common element, you can then go back down.
So if you are in a <?for-each:dataSource?>
You can get the parameter attribute value, where the attribute name = GroupName, by doing:
<?../parameters/parameter[#name='GroupName']?>
Reference:
https://docs.oracle.com/cd/E80149_01/bip/BIPRD/GUID-4D9FC5FC-5A72-4CE6-919C-A3E0D6E4900C.htm#BIPRD2597

Related

tfs 2017 - scrum template - missing statechanged field in some work items

Noticed StateChanged field is missing within XML definitions of some work items in scrum template of tfs 2017 RTM : pbi, testplan, testsuite, feebackrequest, codereviewrequest, and some more.
I assume i should add it manually to them. Right ?
If you mean the State Change Date field, yes, by default it's not added in some work items in scrum template.
Actually the control is not added to layout eventhough in the existing work items such as Bug, Feature. That means, you cannot see the field in work item layout. However you can add the control to display the field based on your requirements.
Yes, you can also add the State Change Date field manually to the work items which not exsiting in them. See Add a field, or apply a rule, or change an attribute for details.
You can also use the TFS Process Template Editor to edit the WITs definitions.
Field:
<FieldDefinition name="State Change Date" refname="Microsoft.VSTS.Common.StateChangeDate" type="DateTime">
<WHENCHANGED field="System.State">
<SERVERDEFAULT from="clock" />
</WHENCHANGED>
<WHENNOTCHANGED field="System.State">
<READONLY />
</WHENNOTCHANGED>
</FieldDefinition>
Layout Control:
<Group Label="Status">
<Column PercentWidth="100">
<Control FieldName="Microsoft.VSTS.Common.StateChangeDate" Type="DateTimeControl" Label="State Change Date:" LabelPosition="Left" />
</Column>
</Group>
Page Section:
<Section>
<Group Label="Status">
<Control Label="State Change Date:" Type="DateTimeControl" FieldName="Microsoft.VSTS.Common.StateChangeDate" />
</Group>
</Section>

Validate TFS 2017 Boolean field

I am trying to edit work item templates to make use of the new Boolean field in TFS 2017, and want a particular field to be set to true before a status can be changed. Is there any way to do this? It would appear ALLOWEDVALUES and MATCH aren't supported, which could have potentially helped
You can do that by applying a conditional rule based on your requirement just as Hamid mentioned above.
Boolean is just a data type, we can add a custom Boolean field and add a checkbox for it.
Use the following syntax to add a Boolean field within the FIELDS
section of the WIT definition.
<FIELD name="Triagelc" refname="lc.Triage" type="Boolean" >
<DEFAULT from="value" value="True" />
<HELPTEXT>Triage work item</HELPTEXT>
</FIELD>
And then add the following syntax within the FORM section to have
the field appear on the form.
<Control Label="Triagelc" Type="FieldControl" FieldName="lc.Triage" />
The field will appear as a checkbox on the form.
Then apply a When rule for target filed, thus when the specified
Boolean field has the specified value, the When rule is applied to
the target field.
eg1:
Apply a "When" rule for Description field in Task work item type :
<FieldDefinition name="Description" refname="System.Description" type="HTML">
<WHEN field="lc.Triage" value="True">
<REQUIRED />
</WHEN>
</FieldDefinition>
Then when set the value to True, the Description area is required, it cannot be empty.
eg2:
You can also use READONLY rule to restrict other areas:
<FieldDefinition name="Assigned To" refname="System.AssignedTo" type="String" syncnamechanges="true" reportable="dimension">
<WHEN field="lc.Triage" value="True">
<READONLY />
</WHEN>
<ALLOWEXISTINGVALUE />
<HELPTEXT>The person currently owning this task</HELPTEXT>
</FieldDefinition>
Thus, when the Boolean field value is True, Assigned To field is read only, otherwise you can assign to the existing users.
UPDATE:
eg3:
We can not achieve that directly with the boolean data type. As a workaround you can try below ways:
Apply the When rule and embed the Copy rule (Copy True as the
value) for the "Triagelc" boolean field in this example. Thus when
the status is Done, Triagelc can set the value to "True"
automatically, then save. But in this way the value still can be
modified to false. Reference below screenshot 1:
<FieldDefinition name="Triagelc" refname="lc.Triage" type="Boolean">
<WHEN field="System.State" value="Done">
<COPY from="value" value="True" />
</WHEN>
<HELPTEXT>Triage work item</HELPTEXT>
</FieldDefinition>
Set the default value to True for Boolean field (Triagelc
field in this example), then apply When rule with READONLY rule
embedded. This way should be meet your requirement (Once done the value cannot be changed anymore). Reference below screenshot 2:
<FieldDefinition name="Triagelc" refname="lc.Triage" type="Boolean">
<DEFAULT from="value" value="True" />
<WHEN field="System.State" value="Done">
<READONLY />
</WHEN>
<HELPTEXT>Triage work item</HELPTEXT>
</FieldDefinition>
Please note that:
The Boolean data type field is only supported for VSTS and TFS 2017.2
and later versions.
Screenshot 1:
Screenshot 2:

Setting TFS field as readonly based on area path

I have custom TFS form with a text field comment. I want this field to be readonly for most of the area paths except 4. How can I add condition to set the field as read only?
basically, when the area id is 1,2,3,4 the comment field should not be readonly else it should be readonly.
I tried the following, but it didn't work
<FIELD name="Comment" refname="test.test.comment" type="Integer">
<WHENNOT field="System.AreaId" value="1">
<READONLY />
</WHENNOT>
<WHENNOT field="System.AreaId" value="2">
<READONLY />
</WHENNOT>
<WHENNOT field="System.AreaId" value="3">
<READONLY />
</WHENNOT>
<WHENNOT field="System.AreaId" value="4">
<READONLY />
</WHENNOT>
</FIELD>
I dont want to write when conditions because these 4 are constant and I have about 40 other area ids which keeps increasing.
No, "And" multiple "WHENNOT" conditions doesn't work. See: Work Item state change rules in TFS - Any way to use "AND"s or "OR"s?
So, instead of using work item rules, you need to work with custom work item control. Determine when to set Comment filed to be readonly via using TFS API. Check this link for the details on how to work with custom work item control: https://witcustomcontrols.codeplex.com/

How to dynamically change the input parameter values to a stored-proc-inbound-channel-adapter

I need to call a stored procedure which gathers data during a specific window. For instance I send in a Timestamp representing now, and a window of 15 minutes and it will return all data within the last 15 minutes. Each time this procedure is called I need update the Timestamp representing now so that I avoid old data.
Is there anyway to achieve this?
My attempt with the "now" bean below is a failure as even though that bean is a prototype it's value is only ever retrieved once when the channel adapter is created.
The anonymised stored-proc-inbound-channel-adapter I currently have configured is below:
<int-jdbc:stored-proc-inbound-channel-adapter
channel="storedProcOutboundChannel" stored-procedure-name="dataWindowRetrieval"
data-source="dataSource" auto-startup="true" id=""
ignore-column-meta-data="false" is-function="false"
skip-undeclared-results="true" return-value-required="false">
<int:poller fixed-rate="60" time-unit="SECONDS"></int:poller>
<int-jdbc:parameter name="CurrentDateTime" type="java.sql.Timestamp" value="#{now}" />
<int-jdbc:parameter name="MinuteOffset" type="java.lang.Integer" value="3" />
<int-jdbc:parameter name="SomeOtherParameter" type="java.lang.Integer" value="4" />
<int-jdbc:parameter name="YetAnotherParameter" type="java.lang.Integer" value="15" />
<int-jdbc:returning-resultset name="theResults" row-mapper="org.springframework.jdbc.core.ColumnMapRowMapper" />
</int-jdbc:stored-proc-inbound-channel-adapter>
<bean id="now" scope="prototype" class="java.sql.Timestamp">
<constructor-arg value="#{ T(java.lang.System).currentTimeMillis()}" />
</bean>
Instead of value use expression="#now".
The value is only evaluated at initialization time.

How to pass a value of a column as a parameter from another column in displaytag using struts2

In the below code, I am trying to pass 2 parameters from <display:column> tag. I have to pass code and level properties to an action(as shown below). I am not able to pass value of another column as parameter from a column. Here I am not getting value of level property in code property.
<s:form action="levelHierarchy">
<display:table id="searchList" name="searchList" pagesize="8"
export="false" requestURI="/getComponentDetails" sort="list">
<display:column property="code" title="Code" sortable="true" paramId="levelId" href="levelHierarchy.action?level=${searchList.level}"></display:column>
<display:column property="description" title="Description" sortable="true" />
<display:column property="level" title="Level" sortable="true" />
<display:setProperty name="paging.banner.placement" value="bottom" />
</display:table>
</s:form>
Inside the form you don't have any fields to submit. You should define at least hidden fields to the columns that contains the values you want to pass to the action. You also need the use of uid attribute of the <display:table tag to access the row values.
<display:table uid="row" id="searchList" name="searchList" pagesize="8" export="false" requestURI="/getComponentDetails" sort="list" >
<display:column property="code" title="Code" sortable="true" paramId="levelId" href="levelHierarchy.action?level=${searchList.level}">
<s:hidden name="submitList[%{#attr.row_rowNum - 1}]" value="%{#attr.row.code}"/>
</display:column>
<%-- Other columns like that --%>
</display:table>
in the action you should create the property placeholder for the submitted values.

Resources