Split String function

3
Is it possible to split a (pipe) delimited string from an attribute in pieces in order to fill other attributes of the same entity? Or can this only be done by Java?
asked
7 answers
3

Perhaps the String Function Calls might help you out.

answered
3

normally in programming you would use indeed as suggested a string function like:

Function Split ( _ Expression As String, _ Delimiter As String, _) as String

e.g. Split("Alice;Bob",";") will create your array of "Alice","Bob"

This allows you to parse variables into an array. Unfortunately i haven't seen such a string function in the provided list "string funtion calls" yet so perhaps you have to write a parser yourself....

answered
1

You can find the first delimiter (often ; or ,) and copy the substring. However the values can only be stored in 'Change object' actions with fixed attribute. In Java you can change an attribute dynamically.

anyObject.setValue(context, memberName, value);
answered
1

use a combination of find and substring :

example am trying to split the first name from the last name by the space

substring(
	$Response/FullName,
	0,
	find(
		$Response/FullName,
		 ' '
	)
)

 

getting the last name for exmaple :

 

substring(
	$Response/FullName,
	find(
		$Response/FullName,
		 ' '
	),
	length($Response/FullName) - 1
	
)

cheers

answered
1

Community Commons –> String split will create a list from a string given the delimiter.

answered
0

Community Commons –> String split will create a list from a string given the delimiter.

answered
-1

For anyone like me also wanting this functionality. There is not an app is the app store:

https://appstore.home.mendix.com/link/app/106771/

Yay!

answered