โ09-02-2021 06:05 PM
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.
Solved! Go to Solution.
โ12-09-2021 06:06 PM
But if those numbers are between quote it means that it is string.
723456 and โ723456โ is not same.
See if this will help you to determine if itโs number or string.
$input.toString().match(/^\d+$/) != null ? true : false
This expression will check if value of input contains only numbers and if it is, then will return true, otherwise if not contains only numbers it will return false.
To check for string itโs opposite, you need to switch the places of true and false.
Regards,
Viktor
โ09-02-2021 10:14 PM
Hi @Sahil,
You can include the โtypeofโ function in a router snap. It will look something like this:
Regards,
Bojan
โ09-03-2021 01:19 AM
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
โ12-06-2021 06:10 PM
@viktor_n , Hi Viktor,
Any suggestions here.
โ12-07-2021 05:40 AM
Hi @Sahil,
Responses from @bojanvelevski and @Spiro_Taleski as I see are correct. Is there are problem with using them ?