cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

We are happy to announce the new Windchill Customization board! Learn more.

Update attributes of a project (wt.proj mgmt.admin.Project 2).

afreitasribeiro
1-Newbie

Update attributes of a project (wt.proj mgmt.admin.Project 2).

Hi, need to update attributes of a project.

The interface allows you to edit one at a time, but I like to do this lot, because I have several projects to upgrade.

I tried doing this via xml, but I have no success.

<%@page language="java"%>

<%@taglib uri="http://www.ptc.com/infoengine/taglib/core" prefix="ie"%>

<%

String typeFather = "wt.projmgmt.admin.Project2";

String typeChild = "net.odebrecht.PROJPO";

%>

<ie:webject name="Query-Objects" type="OBJ">

<ie:param name="INSTANCE" data="windchill" delim="!" valueSeparator="!" default="<%=com.infoengine.au.NamingService.getVMName()%>"/>

<ie:param name="GROUP_OUT" data="resultQuery"/>

<ie:param name="TYPE" data="<%=typeFather%>"/>

<ie:param name="WHERE" data="(number='*')"/>

<ie:param name="ATTRIBUTE" data="*"/>

</ie:webject>

<%

com.infoengine.object.factory.Group obj = getGroup("resultQuery");

int quantidade = obj.getElementCount();

System.out.println("Quantidade de elementos no GRUPO: " + quantidade);

for(int x = 0; x < quantidade; x++){

if(tipoDoc.equalsIgnoreCase("WCTYPE|wt.projmgmt.admin.Project2|net.odebrecht.PROJPO")){

String tipoDoc = (String)obj.getAttributeValue(x,"class");

String number = (String)obj.getAttributeValue(x,"projectNumber");

String atributeprojetoAtual = (String)obj.getAttributeValue(x,"AUFO_CNTR_CODIGO");

String novoAtributoProjeto = (String)obj.getAttributeValue(x,"CNTR_CODIGO_PO_RFQ");

%>

<ie:webject name="Query-Objects" type="OBJ">

<ie:param name="INSTANCE" data="windchill" delim="!" valueSeparator="!" default="<%=com.infoengine.au.NamingService.getVMName()%>"/>

<ie:param name="GROUP_OUT" data="resultQueryChild"/>

<ie:param name="TYPE" data="<%=typeChild%>"/>

<ie:param name="WHERE" data="(number='<%=number%>')"/>

<ie:param name="ATTRIBUTE" data="*"/>

</ie:webject>

<%

System.out.println("Tipo de Documento = "+tipoDoc);

System.out.println("Projeto Atual = "+atributeprojetoAtual);

if(atributeprojetoAtual !=null){

System.out.println("Indice:" + x);

System.out.println("Number: " + number);

System.out.println("Atribute projeto Atual: " + atributeprojetoAtual);

System.out.println("Novo Atributo Projeto: " + novoAtributoProjeto);

%>

<!-- CheckOut-OBJECTS

<ie:webject name="CheckOut-Objects" type="ACT">

<ie:param name="INSTANCE" data="windchill" delim="!" valueSeparator="!" default="<%=com.infoengine.au.NamingService.getVMName()%>"/>

<ie:param name="ATTRIBUTE" data="*"/>

<ie:param name="TYPE" data="<%=typeChild%>"/>

<ie:param name="GROUP_OUT" data="checkoutDocument"/>

<ie:param name="OBJECT_REF" data="$(resultQueryChild[0]obid[0])"/>

</ie:webject>

Update-OBJECTS

<ie:webject name="Update-Objects" type="ACT">

<ie:param name="INSTANCE" data="windchill" delim="!" valueSeparator="!" default="<%=com.infoengine.au.NamingService.getVMName()%>"/>

<ie:param name="FIELD" data="CNTR_CODIGO_PO_RFQ='<%=atributeprojetoAtual%>'"/>

<ie:param name="TYPE" data="<%=typeChild%>"/>

<ie:param name="OBJECT_REF" data="$(checkoutDocumento[0]obid[0])"/>

<ie:param name="GROUP_OUT" data="resultUpdate"/>

</ie:webject>

CheckIn-OBJECTS

<ie:webject name="CheckIn-Objects" type="ACT">

<ie:param name="INSTANCE" data="windchill" delim="!" valueSeparator="!" default="<%=com.infoengine.au.NamingService.getVMName()%>"/>

<ie:param name="ATTRIBUTE" data="*"/>

<ie:param name="GROUP_OUT" data="checkinDocumento"/>

<ie:param name="OBJECT_REF" data="$(resultUpdate[0]obid[0])"/>

</ie:webject> -->

<%

}

}

}

%>

0 REPLIES 0
Top Tags