Forum Discussion

Sahil's avatar
Sahil
Contributor
4 years ago
Solved

Route to port 1 if output is string , to port 2 if output is number

Hi,
I have to route based on the output type using router snap.
Route to port 1 if output is string , to port 2 if output is number.
How to I do that? Thank you.

6 Replies

  • bojanvelevski's avatar
    bojanvelevski
    Valued Contributor

    Hi @Sahil,

    You can include the ‘typeof’ function in a router snap. It will look something like this:

    Regards,
    Bojan

  • SpiroTaleski's avatar
    SpiroTaleski
    Valued Contributor

    @Sahil

    Also in the Router Snap, you can use the instanceof global function that will return true/false if the given object is an instance of the given type.

    ex: $input instanceof ‘String’

    Regards,
    Spiro Taleski