Split string list number and # in reactive
Question
Application Type
Reactive

How to do split number and # from the string and display in table using JavaScript .

Capture13.PNG

Hey,
Please have a look into this OML.
I've created one client action with function - YES and used that in Table record expression.
And it works fine.

TestApp.oml

Champion
Solution

You Just have to understand the

StringSplitSA  

 Server action logic. It fulfill the requirement. Server action as a function cannot be use at UI expression but it can be use at server side expression. So, this is what I did, after fetching the data from Table, just used the StringSplitSA to get the desire value and assign it. 

You can do the same by Javascript. But same can be achieved by Outsytems text action like String split, rgex search and replace. 

Thanks. 

Hey Preeti,
We have Built-in functions in outsystems to achieve this.

Try this in expression of that table record. It will return 37.

Regards,
Gnanavel Sivasankaran

Hi @Gnanavel Sivasankaran ,

I want to display Admin , Employee so how I can achieve this? 

Thanks,

Preeti

Capture13.PNG

Hey,
 Try this -

Substr("37#Admin",Index("37#Admin","#")+1,Length("37#Admin"))

Instead of "37#Admin" you can pass your current variable.

Hi , 

I tried this,

Substr(DataAction1.Out1.Current.Roles,Index(DataAction1.Out1.Current.Roles,"#")+1,Length(DataAction1.Out1.Current.Roles))

It looks like this

Capture15.PNG

If possible could you share your OML here. So that I can check that.

Hey,
Please have a look into this OML.
I've created one client action with function - YES and used that in Table record expression.
And it works fine.

TestApp.oml

Why use javascript? Outsystems has built-in functions just for such a purpose?

From what I can see from the screenshot, you may need to add a loop infront of the current substring assignment. It would help if you can upload the OML.

Cheers


Champion

Hi Preeti,

Please check -    Sample screen

You can achieve this by using Replace Built in function, Regex Search and String Split action. 

Ex-2

Data in my RoleTable-

and At UI- 

Please find the uploaded OML.


Thanks

StringSplit.oml

Thank you @Rahul Kumar ,I tried its not working as per my requirement. 

Champion
Solution

You Just have to understand the

StringSplitSA  

 Server action logic. It fulfill the requirement. Server action as a function cannot be use at UI expression but it can be use at server side expression. So, this is what I did, after fetching the data from Table, just used the StringSplitSA to get the desire value and assign it. 

You can do the same by Javascript. But same can be achieved by Outsytems text action like String split, rgex search and replace. 

Thanks. 

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