For your specific example where you sometimes have a string "1234 Name Street" and sometimes just "Place Name" and you want the 1234 from the first and NotSet from the second...
Regular expressions would help, but yes are not available in Architect Expressions. The first thing that comes to mind is you could do a boolean with the Contains function and check that it contains 1 or 2 or 3 or 4 etc. Not sure if a simple greater than or less than symbol will error with a string, but it is also worth a shot.
Otherwise you could feed it in to a Genesys bot, and have a slot setup with regular expression, and then just return the slot value back out and use that, which seems a little overkill to me.
Just a couple of initial ideas, might come up with something better.
------------------------------
Anton Vroon
------------------------------
Original Message:
Sent: 06-16-2022 11:34
From: Paul Simpson
Subject: Expressions, Methods and Attributes in Architect - documentation?
Hi,
OK, so I'm looking for the "missing link" in the documentation for Architect.
In the Classroom Manual for the Beyond training it states "You can use expressions in the flow for complex decision making and formatting the customer inputs. A regular expression is a sequence of characters that forms a search pattern, mainly for use in pattern matching with strings, or with string matching, such as in find and replace operations. Genesys Cloud uses regular expressions to normalize phone addresses, classify calls, and format a phone number for display purposes.", which I know is confusing Expressions with Regular Expressions, but clearly implies the latter is possible.
Later on the same page some examples are given that clearly treat some values as objects with methods and properties. For example:
ToPhoneNumber(Call.Ani).dialingCode to extract the Dialing code from an inbound call.
In the Resource center, Regular expressions are also mentioned for various purposes (mostly, to be fair in things like Dial Plans) but some in the context of Architect.
Unfortunately, I can't find any comprehensive documentation of all data types and their methods / properties. (I found Phone Number, but can't find String, for example.)
Specifically, what I am trying to do is to take a string that contains the forst line of an address and extract the numeric portion, if there is one. The key is "If there is one". If I take an address like "7601 Interactive Way", and use ToInt(), I get 7601. excellent. Unfortunately according to the documentation, if I were to try to do this for a value like "Indianapolis Office", it will generate an error. I cannot find a boolean function I can use to either test for an error, or test for a value being numeric (in which case, I could simply test the first character) so I figured Regular Expressions may be the way forward, however.. Now, sure, I could test the first character against each of the possible digit values, but that seems to be very long-winded and inefficient.
So, can anyone point me at a comprehensive guide to Architect Expressions? (Or suggest a solution that doesn't involve writing a web service!)
As always, TIA
#ArchitectureandDesign
------------------------------
Paul Simpson
Sr. Cloud Partner
AAA Club Alliance Inc.
------------------------------