Start a new topic
Answered

How do I retrieve item status using the path language?

When writing a path expression, I want to get the item Status and then test for it to write some conclusion in a grid.


Best Answer

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.


<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>
    <Text>#{? Status(.)}</Text>
</Report> 


 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


Answer

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.


<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>
    <Text>#{? Status(.)}</Text>
</Report> 


 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

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?

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.

 

<Report>
	<Filter  name="NoDescription" >
		<DescriptionIsEmpty/>
	</Filter>
	<Function name="NoDescription" as="Boolean">
		<Parameter name="ItemToCheck" as="Items"/>
		<Choose>
			<When filter="NoDescription">
				<Value select="true"/>
			</When>
			<Otherwise>
				<Value select="false"/>
			</Otherwise>
		</Choose>
	</Function>       
	<Text>#{? NoDescription(.) }</Text>
</Report>


 

Thank you, 

Systemite Support

Login to post a comment