Page 1 of 1

Issue with IF function

Posted: Fri Apr 01, 2016 8:53 am
by dhascup
My IF function is not working properly

In the productType "CA" comes out as it should
In the packagingType "PK" comes out when it should be "CT"
They both refer to dataItem[7]

Code: Select all
<element name="globalAttributes">
									<element name="productType" value="${dataItem[7]}" trim="both" />
									<element name="globalClassificationCategory" trim="both">
										<element name="code" value="${dataItem[58]}" trim="both" />
									</element>
									<element name="gtinName" value="${dataItem[9]}" trim="both">
										<attribute name="lang" value="en" trim="both" />
									</element>
									<element name="brandName" value="${dataItem[5]}" trim="both" />
									<element name="brandOwnerGLN" value="${dataItem[6]}" />
									<forEach inputRowSetVariable="${dataNetContent}">
										<if test="${dataNetContent[1]} eq ${dataItem[2]}">
											<if test="${dataNetContent[2]} eq ${dataItem[3]}">
												<element name="netContent" value="${dataNetContent[3]}" trim="both">
													<attribute name="uom" value="${dataNetContent[4]}" trim="both" />
												</element>
											</if>
										</if>
									</forEach>
									<element name="packagingType" trim="both">
										<element name="code" value="${If((dataItem[7] == "CA"), "CT", "PK")}" trim="both" />
									</element>

See attachment for captured result


Thanks
David

Re: Issue with IF function

Posted: Wed Apr 06, 2016 10:37 am
by Support_Rick
Dave,

More than likely there are some spaces in the data. Please review and/or remove them and let me know.

Thanks!