Play Audio according to input message
Application Type
Traditional Web

I'm implementing an audio play app.

About the function

open my app in browser

The below is what I want to implement.

1: I put a message in the input box "Message" and press "Send" button.

2: Then I want the mp3 file to play on the screen as the first insert image.

3: But as the second insert image, I want to change audio files to play according to my input message I put.

Ex.  Let's say I put "Tough" in the input box.Then "sample1.mp3" plays.


I made this kind of audio play app from scratch and tried many times through the trial and error,

but I can't implement just audio play.  I debugged it but I couldn't figure out what's wrong.

Are you familiar with this matter?

I'd appreciate it if you could give me some good advice and tell me what's the issue.


I have attached my .oml file for your information.

Best regards,

EncourageYou.oml

Champion
Solution

Hi Yoshikawa San

if you just want to check if the input includes some string Index function can do it.

But your expression is wrong. It should be like below.

Index(Input,"tough") >= 0

Please also refer to

https://success.outsystems.com/Documentation/10/Reference/OutSystems_Language/Logic/Built-in_Functions/Text?origin=d#Index

Kind regards,

Hello,

I made some trial and error on your .oml and I think that it is close to what you want. Please check the .oml and see if it fits your needs.

You should make adjustments to the variables and file paths as needed.

If you have more questions feel free to ask.

EncourageYou.oml

Thank you so much!

This fits what I want.

I just want to  implement the below.

Ex. 

If the input message is "It was tough"  and "tough" is included,  sample1.mp3 plays.

If the input message is "It was terrible", sample3.mp3 plays because "terrible" is included,

This is what I'm expecting...


I tried to implement it with Regex on Switch widget and to use Server action of "Regex_search" but I'm stuck on it. 

I just set Condition 1 on Switch widget to 

Index(Input,"tough") = NullIdentifier()

and published it and tried in browser but it didn't work. I wonder if my Regex is wrong... 

Do you have any ideas?

It'd be great if you could give me your expertise.

Best,

Champion
Solution

Hi Yoshikawa San

if you just want to check if the input includes some string Index function can do it.

But your expression is wrong. It should be like below.

Index(Input,"tough") >= 0

Please also refer to

https://success.outsystems.com/Documentation/10/Reference/OutSystems_Language/Logic/Built-in_Functions/Text?origin=d#Index

Kind regards,

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.