How do I retrieve item status using the path language?
Stacey Hwasser
创建话题
超过5年 以前
When writing a path expression, I want to get the item Status and then test for it to write some conclusion in a grid.
最佳答案
S
SystemWeaver Support
说
超过5年 以前
Today the SystemWeaver Path Query Language doesn’t support item Status. However, it is possible to work around this by using SystemWeaver Function and Filters. After defining a function, you can then use it in Path Query Language.
Below is an example for a function called Status, that requires a parameter of type Item and returns a string value which is the status of the received item. This Function can by used in any SystemWeaver configuration type, i.e., Grid, Report, Document, Graph and Chart.
Today the SystemWeaver Path Query Language doesn’t support item Status. However, it is possible to work around this by using SystemWeaver Function and Filters. After defining a function, you can then use it in Path Query Language.
Below is an example for a function called Status, that requires a parameter of type Item and returns a string value which is the status of the received item. This Function can by used in any SystemWeaver configuration type, i.e., Grid, Report, Document, Graph and Chart.
The SystemWeaver Path Query Language doesn’t support finding objects with an empty description either. Is it possible to do the same to check if an item description is empty using the path language?
SystemWeaver Support
说
超过5年 以前
Hi Bashar,
Yes, using SystemWeaver Function and Filter can do the job.
Below is an example for a function called NoDescription, that requires a parameter of type Item and returns a a Boolean value which is true if an item has an empty description and false if the item has a description. This Function can by used in any SystemWeaver configuration type, i.e., Grid, Report, Document, Graph and Chart.
Ok, but if you want some logic regarding item status into a field in a document header, how is that done?
Best regards
Martin
B
Bashar Nassar
说
约3年 以前
Hi Martin,
In general you can't get an item status into a field in a document header, similar to how the other fields works, as shown below.
However, what you are asking for is still doable using the "Report XML Definition" and the result will be printed out in header.
To achieve that, you can add the following into you document XML definition. In this example, we are applying some logic regarding item status but you can replace this logic with whatever you want. The logic that we are using here is to print the status of the Document item, in addition to the number of items that are not CS_Released.
Report XML Definition:
<Report>
<!--
I: Checked in (Default value for items)
O: Checked out
F: Frozen
R: Released
X: CS Released
-->
<Filter name="Released">
<ItemStatusEquals value="R"/>
</Filter>
<Filter name="CS_Released">
<ItemStatusEquals value="X"/>
</Filter>
<Filter name="Frozen">
<ItemStatusEquals value="F"/>
</Filter>
<Filter name="Work">
<ItemStatusEquals value="I"/>
</Filter>
<Function name="Status" as="String">
<Parameter name="ItemToCheck" as="Items"/>
<Choose>
<When filter="Released">
<Value select="'Released'"/>
</When>
<When filter="CS_Released">
<Value select="'CS_Released'"/>
</When>
<When filter="Frozen">
<Value select="'Frozen'"/>
</When>
<When filter="Work">
<Value select="'Work'"/>
</When>
<Otherwise>
</Otherwise>
</Choose>
</Function>
<Function name="getAllItems" as="Items">
<Parameter name="p1" as="Items"/>
<Parameter name="PreviousItems" as="Items"/>
<Variable name="NextItems" as="Items" select="$p1/part::*/defobj::[not . in $PreviousItems]"/>
<Variable name="Accumulated" as="Items" select="$PreviousItems union $NextItems"/>
<Value select="if $NextItems then getAllItems($NextItems, $Accumulated) else $Accumulated"/>
</Function>
<Text>Document Status: #{? Status(.) } </Text>
<Text>Number of Document's items that are not CS_Released: #{? if Status(.) != 'CS_Released' then getAllItems(.,[])[Status(.) !='CS_Released'].Count else Status(.)}</Text>
<!--Add the rest of your document definition here-->
</Report>
The result:
Which will be added to 'Header'
Best regards
Bashar
M
Martin Ivarsson
说
约3年 以前
Ok, maybe I should have been a bit more explicit. I need to get this logic into a cell in a table in a title header. This wont solve that right? And the example above is a little simple as well since it is added once and not to all headers for all pages. Or am I missing something? Is there some magic that I am not seeing?
Best regards
Martin
B
Bashar Nassar
说
约3年 以前
That is true, the provided example is simplified and the status information will be added once (will not be added to all headers for all pages).
To support your use case which is to get this logic into a cell in a table in a title header for all pages, we need to add the support to retrieve an item status using the path language which then can be used either in a computed attribute or a field. Unfortunately, we don't have this support today but it will be added in the future.
Stacey Hwasser
When writing a path expression, I want to get the item Status and then test for it to write some conclusion in a grid.
Today the SystemWeaver Path Query Language doesn’t support item Status. However, it is possible to work around this by using SystemWeaver Function and Filters. After defining a function, you can then use it in Path Query Language.
Below is an example for a function called Status, that requires a parameter of type Item and returns a string value which is the status of the received item. This Function can by used in any SystemWeaver configuration type, i.e., Grid, Report, Document, Graph and Chart.
To see more examples of how to define and call functions, see Defining Custom Functions Using SystemWeaver Path Expressions.
Hope that answers your question.
Systemite Support
- 最早在前
- 热门
- 最新在前
Sorted by 最早在前SystemWeaver Support
Today the SystemWeaver Path Query Language doesn’t support item Status. However, it is possible to work around this by using SystemWeaver Function and Filters. After defining a function, you can then use it in Path Query Language.
Below is an example for a function called Status, that requires a parameter of type Item and returns a string value which is the status of the received item. This Function can by used in any SystemWeaver configuration type, i.e., Grid, Report, Document, Graph and Chart.
To see more examples of how to define and call functions, see Defining Custom Functions Using SystemWeaver Path Expressions.
Hope that answers your question.
Systemite Support
Bashar Nassar
The SystemWeaver Path Query Language doesn’t support finding objects with an empty description either.
Is it possible to do the same to check if an item description is empty using the path language?
SystemWeaver Support
Hi Bashar,
Yes, using SystemWeaver Function and Filter can do the job.
Below is an example for a function called NoDescription, that requires a parameter of type Item and returns a a Boolean value which is true if an item has an empty description and false if the item has a description. This Function can by used in any SystemWeaver configuration type, i.e., Grid, Report, Document, Graph and Chart.
Thank you,
Systemite Support
Martin Ivarsson
Ok, but if you want some logic regarding item status into a field in a document header, how is that done?
Best regards
Martin
Bashar Nassar
Hi Martin,
In general you can't get an item status into a field in a document header, similar to how the other fields works, as shown below.
However, what you are asking for is still doable using the "Report XML Definition" and the result will be printed out in header.
To achieve that, you can add the following into you document XML definition. In this example, we are applying some logic regarding item status but you can replace this logic with whatever you want. The logic that we are using here is to print the status of the Document item, in addition to the number of items that are not CS_Released.
Report XML Definition:
The result:
Which will be added to 'Header'Best regards
Bashar
Martin Ivarsson
Ok, maybe I should have been a bit more explicit. I need to get this logic into a cell in a table in a title header. This wont solve that right? And the example above is a little simple as well since it is added once and not to all headers for all pages. Or am I missing something? Is there some magic that I am not seeing?
Best regards
Martin
Bashar Nassar
That is true, the provided example is simplified and the status information will be added once (will not be added to all headers for all pages).
To support your use case which is to get this logic into a cell in a table in a title header for all pages, we need to add the support to retrieve an item status using the path language which then can be used either in a computed attribute or a field. Unfortunately, we don't have this support today but it will be added in the future.
Best regards
Bashar
SystemWeaver Support
With our Kålltorp (R46), ItemStatus is now included in our Path Query Language. See Path Language: Addition of ItemStatus in Kålltorp (R46) Release Notes Summary - June 5, 2024.
Best regards,
SystemWeaver Support
-
Conditional rows in Tables and Grids
-
Dynamic columns in tables and grids
-
Graphical all references
-
Controlling what columns to show in Grids and Tables
-
Custom version compare using the Script Language
-
Requirements don't show up on test views (Requirements and Coverage view)
-
How to attach an Error log to a test case
-
Using the path language to get the latest version of an item
-
How to show the SystemWeaver xID as a column in SystemWeaver
-
/back:: vs Context:/back::
查看所有24话题