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

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

How to Access Veriables In a JSP page ForEach Loop?

breed
12-Amethyst

How to Access Veriables In a JSP page ForEach Loop?

I will post some code below that works for me. However I would like to replace the 'testing' strings with a variable passed to the for each loop from the epmdocument group. I cannot figure out the syntax for doing this. If I place <ie:getValue name="CADName"/> where the variable is then I get an error when I execute. I am assuming I am supposed to do something like ${CADName} but, I am not sure how to reference that value?

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

           <ie:param name="INSTANCE" data="com.jbtc.net.mad1wc-prod01.Windchill"/>

           <ie:param name="TYPE" data="wt.epm.EPMDocument"/>

           <ie:param name="VERSION" data="LATEST"/>

           <ie:param name="ITERATION" data="LATEST"/>

           <ie:param name="WHERE" data="<%=where%>"/>

           <ie:param name="WHERE" data="(state.state='Released')" />

        <ie:param name="ATTRIBUTE" data="CADName,name,state.state,versionInfo.identifier.versionId,obid" delim=","/>

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

    </ie:webject>

            <ie:forEach groupIn="epmdocument" groupOut="row">

                <c:choose>

                 <c:when test="${'testing123' == 'testing123'}">

                     <p> This is output to HTML page if CADName is testing123</p>

                 </c:when>

                 <c:otherwise>

                   <p> Fail </p>

                 </c:otherwise>

                </c:choose>

                <p class=<ie:getValue name="CADName"/>><ie:getValue name="CADName"/> This code works I get the variable back</p>

            </ie:forEach>

1 REPLY 1

Hello breed,

Did you ever get this working?

 

I would suggest a couple things, First, make sure you have referenced the correct symbol library to use the "forEach" and "choose" symbols.

 

<%@taglib uri="/com/infoengine/tlds/iejstl.tld" prefix="c"%>

 

This will require that you are using a task and not jsp.

 

Secondly, when using the forEach to get to a value in the group, use the specific instance name you have given, "row".

 

<c:when test="${row[]cadName[] == 'testing123'}">

 

Hope that helps you or anyone else stumbling across this years later, like I did.

Announcements


Top Tags