Quantcast
Channel: PTC Community : Unanswered Discussions - Windchill
Viewing all articles
Browse latest Browse all 3592

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

$
0
0

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> -->

<%                              

                               }

              } 

        }

%>


Viewing all articles
Browse latest Browse all 3592

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>