question

Edward Ellis avatar image
0 Likes"
Edward Ellis asked Joerg Vogel answered

Send to port by itemtype

Hi I have a quick question. I want to validate the itemtype and in the case that it has getitemtype(item) == 1 or 2 I want it to go to certain ports. It is working when I state getitemtype(item) == 1 but how do I add to validate for 2 as well?

Do I use commas, or, what do I do to validate the itemtype for both 1 or 2?

Thank you for your help!

Edward Ellis

Choose One
flexscriptitemtypesend to port
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Joerg Vogel avatar image
0 Likes"
Joerg Vogel answered Matt Long edited

switch(getitemtype(item))
{
	case 1: 
	case 2: 
		return 1;
	default: 
		return 0;
}

As long as there isn't a break or return-command the structure is computing from above to bottom. If case 1 becomes true the code executes in the case 2 the return value. Otherwise default:


5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Adrian Haws avatar image
1 Like"
Adrian Haws answered Arimba W commented

Edward,

If you want to send itemtype 1 for port 1 and itemtype 2 to port 2 you can use the "Port by Case" picklist option in a fixed resource's "Send to Port" field. This is what that might look like:

If you want to send an item to port 1 if itemtype is 1 or 2 you would choose "Conditional Port" with syntax like this:


5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.