How to split a comma-separated string and add the values into a Value List property?

Hi,
I have a string that contains multiple values separated by commas, for example:


 

"value1, value2, value3, value4"

I need to split this string using the comma delimiter and then add each value into a Value List property in Pega.

What is the best way to implement this?

  • Using a Data Transform?

  • Or any recommended approach to handle this in Pega?

If you have sample Java code or a best-practice solution, please share.

Thanks in advance!

@Eranda10274

You could make use of Apply-Parse-Delimited method in activity.

  1. Create a Parse Delimited rule to parse the comma separated value and convert it to value list.

  2. Call the same rule from activity by using Apply-Parse-Delimited method. Attached screen shot for reference.

Param.CCAddress = Comma Separated Values should be sent as an input parameter.

.AddressList = Return value will get stored in this value.

@Eranda10274

There is an existing function “pxPageListFromStringCSV” in PEGA. You can check that. That should help you to create a pagelist out of CSV values. You can copy the page list data to you value list then.