Hi. I want to get itemId from item group result of...
# suitescript
c
Hi. I want to get itemId from item group result of SavedSearch list in map/reduce script. Maybe it's easier to explain with images. Please let me know if someone knows about the solution
a
Looks like you started to do this with itemlList? but you're using
getvalue
instead of
getValue
... I think this should work, but you obviously need to change any code that looks at
data
to use the itemId/ itemName instead of just item.
Copy code
if (result.getValue(columns[1]) !=0) {
	data.push({
	  itemId: result.getValue(columns[0]),
	  itemName: result.getText(columns[0]),
	  qty: result.getValue(columns[1]),
	  amount: result.getValue(columns[2])
	});
}
c
thanks for your replay. I already tried with getValue() but it didn't return itemID. Because as you can see the images, Item field is a itemlist not a single item.
a
yeah ok let me try again, I don't use columns[x] and getValue works differently if you pass in a a column instead of a field name etc.
umm what i see from the images (i think) its not clear since you didn't provide everything I would need. is that they ARE all the same item, they're just grouped by item on the search? the internal ID of every entry on the drill down is 6377630
is your data object getting anything added to it correctly?
are you getting any error messages?
if qty and amount are working then should be ok to leave those. using the column references.
Copy code
if (result.getValue(columns[1]) !=0) {
	data.push({
	  itemId: result.getValue({
		name: 'item',
		summary: search.Summary.GROUP
	  }),
	  itemName: result.getText({
		name: 'item',
		summary: search.Summary.GROUP
	  }),
	  qty: result.getValue(columns[1]),
	  amount: result.getValue(columns[2])
	});
}
c
thank you. there was my spelling fault. now everyting is working well. good weekend
👍 1
e
Curious, was this in the getinputdata stage or in map or reduce?
c
it was in getInputData stage
If you want a whole code, I can provide you
e
no, fine. was just curious. all good - you got it straightened out