Hello Text Blaze Community I'm trying to make a snippet that gathers the information of a website showing metrics and the time Representatives have in an specific status, I need to filter from all the data only the agents that are in the status Available and take the time they have in that status(appearing below the Available word in the data) and from all of those times I need to find the longest one and input that time as the response of the snippet, here is an example of the data and the input that I need
DATA:
exampleemail@asd.com
Voz
After contact work
- 00:02:45 Example asdafkmsfkmsdelfkkadkfajkfjangpkfjgnpsfgdfaffafsfgsgdfbsfgsfgsfdgdfg
exampleemail@asd.com
Voz
On contact
- 00:21:06 Example asdafkmsfkmsdelfkkadkfajkfjangpkfjgnpsfgdfaffafsfgsgdfbsfgsfgsfdgdfg
exampleemail@asd.com
Voz
Available
- 00:02:40 Example asdafkmsfkmsdelfkkadkfajkfjangpkfjgnpsfgdfaffafsfgsgdfbsfgsfgsfdgdfg
exampleemail@asd.com
Voz
Available
- 00:02:38 Example asdafkmsfkmsdelfkkadkfajkfjangpkfjgnpsfgdfaffafsfgsgdfbsfgsfgsfdgdfg
So from this data there is only 2 agents in ''Available'' and the longest time within those 2 is 02:40, in the actual data there is going to be +50 agents in Available and a lot more information.
INPUT of the desired snippet: 02:40
Thank you so much in advance I hope somebody can help me in figuring out how to set it up.
Hello Cesar! Great question and I'll do my best to help you with this ![:slight_smile: :slight_smile:](https://community.blaze.today/images/emoji/twitter/slight_smile.png?v=12)
A few clarifying questions so that I can make the most appropriate recommendations:
Can you tell me more about the data you are showing? It would be helpful to understand what "Voz" is, why each row has the same email, where this data is being stored, and those types of characteristics.
Also, do you already have your data included in the snippet and just need some help with the formula? Or do you also need assistance with getting the data into the snippet in the first place?
Sure thing, Oliver
Data is coming from a tracker that displays real time metrics of live agents, the emails and words you see are just part of the example sample data, they were just included in the example to better showcase how the data is display when extracted from the website, I already got the data I need from the website so that part is done, I'm just trying to figure out how to get information that I need filtered.
Thanks again!
Hi @Cesar_Adrian_Echever,
I tried creating a snippet from information about the use case given. You can try it by putting your data from website in data
variable like {data={site:...}}
. I have included the data you sent for illustration. Let me know if you need more help on it.
{data="exampleemail@asd.com
Voz
After contact work
00:02:45 Example asdafkmsfkmsdelfkkadkfajkfjangpkfjgnpsfgdfaffafsfgsgdfbsfgsfgsfdgdfg
exampleemail@asd.com
Voz
On contact
00:21:06 Example asdafkmsfkmsdelfkkadkfajkfjangpkfjgnpsfgdfaffafsfgsgdfbsfgsfgsfdgdfg
exampleemail@asd.com
Voz
Available
00:02:40 Example asdafkmsfkmsdelfkkadkfajkfjangpkfjgnpsfgdfaffafsfgsgdfbsfgsfgsfdgdfg
exampleemail@asd.com
Voz
Available
00:02:38 Example asdafkmsfkmsdelfkkadkfajkfjangpkfjgnpsfgdfaffafsfgsgdfbsfgsfgsfdgdfg
"}
{available_agents=filter(split(data, "@"), (agent)-> contains(agent, "Available"))}
{times=map(available_agents, (agent)->extractregex(agent, "\d{2}:\d{2}:\d{2}"))}
{=reduce(times, "00:00:00", (a, v) -> a if join(split(a, ":"), "") > join(split(v, ":"), "") else v)}
References
This is perfect! It worked like a charm, Thank you so much! @Ashwin_MittalTB
1 Like