Genesys Cloud - Developer Community!

 View Only

Sign Up

  • 1.  How to validate a variable value is numeric or not

    Posted 05-02-2025 12:33

    I am working on one inbound call flow. I have define a variable and that variable is holding some value. Please help me to write an expression in decision block to valid that variable is holding numeric values or not.

    Currently I am using below expression:

    Solution 1: 

    (
    contains(Flow.conciergeBotActionData, "1") or 
    contains(Flow.conciergeBotActionData, "2") or
    contains(Flow.conciergeBotActionData, "3") or
    contains(Flow.conciergeBotActionData, "4") or
    contains(Flow.conciergeBotActionData, "5") or
     
    contains(Flow.conciergeBotActionData, "6") or
    contains(Flow.conciergeBotActionData, "7") or
    contains(Flow.conciergeBotActionData, "8") or
     
    contains(Flow.conciergeBotActionData, "9") 
    Or
    contains(Flow.conciergeBotActionData, "0") 
    )
    Solution 2: 
    (ToInt(Substring(Flow.conciergeBotActionData,0,1)) > 0 and ToInt(Substring(Flow.conciergeBotActionData,0,1)) < 10) and
    (ToInt(Substring(Flow.conciergeBotActionData,1,1)) > 0 and ToInt(Substring(Flow.conciergeBotActionData,1,1)) < 10) and
    (ToInt(Substring(Flow.conciergeBotActionData,2,1)) > 0 and ToInt(Substring(Flow.conciergeBotActionData,2,1)) < 10) and
    (ToInt(Substring(Flow.conciergeBotActionData,3,1)) > 0 and ToInt(Substring(Flow.conciergeBotActionData,3,1)) < 10) and
    (ToInt(Substring(Flow.conciergeBotActionData,4,1)) > 0 and ToInt(Substring(Flow.conciergeBotActionData,4,1)) < 10) and
    (ToInt(Substring(Flow.conciergeBotActionData,5,1)) > 0 and ToInt(Substring(Flow.conciergeBotActionData,5,1)) < 10) and
    (ToInt(Substring(Flow.conciergeBotActionData,6,1)) > 0 and ToInt(Substring(Flow.conciergeBotActionData,6,1)) < 10) and
    (ToInt(Substring(Flow.conciergeBotActionData,7,1)) > 0 and ToInt(Substring(Flow.conciergeBotActionData,7,1)) < 10) and
    (ToInt(Substring(Flow.conciergeBotActionData,8,1)) > 0 and ToInt(Substring(Flow.conciergeBotActionData,8,1)) < 10) and
    (ToInt(Substring(Flow.conciergeBotActionData,9,1)) > 0 and ToInt(Substring(Flow.conciergeBotActionData,9,1)) < 10)
    Any suggestions?

    #Architect

    ------------------------------
    Vishwath Reddy Mandadi
    ------------------------------


  • 2.  RE: How to validate a variable value is numeric or not

    Posted 05-05-2025 04:47

    Hi

    What possible value(s) are expected in that variable?



    ------------------------------
    Cheers
    Zubair
    ------------------------------



  • 3.  RE: How to validate a variable value is numeric or not

    Posted 05-05-2025 10:26

    Hi,

    Variable can hold any value like "asd123" or ABCD or 1234567890. I have to just validate that varaiable is holding a valid numeric digit or not.



    ------------------------------
    Vishwath Reddy Mandadi
    ------------------------------



  • 4.  RE: How to validate a variable value is numeric or not

    Posted 05-06-2025 01:42

    Another approach could be using a loop that runs 10 times with the loopCount variable used for comparison in the decision block inside the loop. Expression would be 

    contains(Flow.conciergeBotActionData, Task.loopCount)

    Under the true path simply set a flag then exit and carry on



    ------------------------------
    Cheers
    Zubair
    ------------------------------



  • 5.  RE: How to validate a variable value is numeric or not

    Posted 05-08-2025 03:35

    Solution 2 will throw a run time error and go to Event Handling if you try to convert a letter to an integer. You probably don't want that.



    ------------------------------
    George Ganahl GCCX-AI, GCP, GCSME, ICCE, ICHD, etc.
    Technical Adoption Champion
    Genesys
    ------------------------------



  • 6.  RE: How to validate a variable value is numeric or not

    Posted 05-08-2025 03:52

    https://genesyscloud.ideas.aha.io/ideas/SSAAOB-I-141 

    and

    https://genesyscloud.ideas.aha.io/ideas/SSA-I-240

    request regular expression support in Architect flows, so you might vote for them.

    One suggestion I saw says to use a data action to call an external RegEx validator to test the string



    ------------------------------
    George Ganahl GCCX-AI, GCP, GCSME, ICCE, ICHD, etc.
    Technical Adoption Champion
    Genesys
    ------------------------------