Hot answers tagged

8 votes
Accepted

Split a row with data separated by ","

Guide Template Language does this effortlessly. No need for SSJS, or awkward AMPscript process loops. The following code: %%[ var @products set @products = '[{"item":"Elastic love","sku ":"...
user avatar
  • 15.5k
6 votes

Is it possible to override String.split function in Salesforce Apex?

No. The Apex language has no support for what other languages might call mixins or categories. You can only subclass and extend classes declared virtual or abstract, which the system's String class is ...
user avatar
  • 85.9k
6 votes
Accepted

How to reproduce a unique list based on a field value

Whenever you need a unique anything, you need a Set or a Map, depending on the circumstances. For example, unique values by Age: Map<Decimal, SObjType> uniqueAges = new map<Decimal, SObjType&...
user avatar
  • 429k
4 votes
Accepted

String Split method

Your value is an empty string. There is nothing to split that matches your criteria which means the whole string (empty string) will be the result and it will be placed at the first index in the ...
user avatar
4 votes

Trigger to remove text before and after

You should be able to match using multiline mode in a pattern: Pattern p = Pattern.compile('(?m)By User: (.+?)$'); for(Case record: Trigger.new) { record.Response_Name__c = null; if(record....
user avatar
  • 429k
4 votes
Accepted

Equally Split a DE by segment

There is an option to separate out each by the column then use a random split or similar - but that is fairly manually intensive (but requires less technical knowledge) and would require 3 for each ...
user avatar
  • 27.8k
3 votes
Accepted

How to separate The Day, Month and Year attributes using SQL _Open query in salesforce marketing cloud?

You can use Datepart() function. In your case it would be select Datepart(year, EventDate) as Year, Datepart(month, EventDate) as Month ... from _Open
user avatar
3 votes

How To Split String by space and store each character or substring in array

Usage of String.split method doesn't fit your requirements, as you will have '(1' first element and '2)' third element. Use String.splitByCharacterType method. Splits the current String by ...
user avatar
3 votes
Accepted

Attempt to de-reference a null object - Error in sorting list

If this is the line that is throwing the error: surveyInstanceListsorted.add(sq); // This line throws error. The most likely scenario is that ahead of this block of code which you're showing us ...
user avatar
  • 22.3k
3 votes

apex string split

String.split() expects a regular expression, not a string. Use myString.Split('\\$\\$\\$'); (Thanks to @Mugambo) https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/...
user avatar
3 votes
Accepted

Refresh/update data extension random splits

If you are using a "Random Data Extension", these cannot be refreshed. Filtered data extension can be refreshed but these random data extensions cannot. http://help.exacttarget.com/en/...
user avatar
  • 1,255
2 votes
Accepted

Split by semicolon of a string not working

Definitely is not an issue with splitting the string, simplified the code a bit and ran the following in the execute anonymous window to demonstrate: List<String> Useremails = new List<...
user avatar
  • 10.4k
2 votes

How to place the google map address in account object?

You can check it out the spring'15 releases notes, Standard Address Fields Show Google Maps Use Visualforce Map Components to Show Location Data More Clearly
user avatar
2 votes
Accepted

Marketing Cloud - Journey splitted according to email opening

You will need to create an engagement split for this . Check the screenshots below Drag the engagement split and configure Note that you need to configure first email and then use engagement split ...
user avatar
2 votes
Accepted

Parse HTTP Response

There are many ways to parse it, but probably the simplest is to use String.split. Something like the following should get you started. Map<String, String> payload = new Map<String, String&...
user avatar
  • 142k
2 votes
Accepted

Selectlist options change not reflecting in apex class

An Apex controller constructor only runs when the page is first opened. When an apex:actionSupport or apex:commandButton runs the controller, the controller instance is re-created from the view state ...
user avatar
  • 129k
2 votes

split before GROUP BY soql

Create a field to contain your first five digits. Populate it via Workflow Rule/Process Builder/Apex Trigger. The contents will be: LEFT(My9DigitField__c, 5) Or alternatives in Apex: ...
user avatar
  • 142k
2 votes
Accepted

How to write a method to remove non alphanumerics in a string and display it in a list

you can use regular expressions here split accepts regex strings as well. in current case regex to split string by all non-alphnumerics is [^\\w\\s]+ you can try this regex here Explanations to it:...
user avatar
2 votes

Split text data by number

For numeric 10 digit value, regex pattern is [0-9]{10}. Following code works perfectly for me. // First, instantiate a new Pattern object "MyPattern" Pattern MyPattern = Pattern.compile('[0-9]{10}');...
user avatar
2 votes
Accepted

SSJS Split String

It should be as simple as: var parts = source.split(/(?<=_)/); Where /.../ is a regular expression, (?<=...) is a look-behind, and _ is the thing you're trying to split after.
user avatar
  • 429k
2 votes

Random Data Extensions: Need to split larger audience into 20 different DEs

The way to get the most accurate split of your audience would be to use a rank() and count() to a staging table and then use math in the following queries to build out your segments. Staging Query: ...
user avatar
  • 27.8k
2 votes

Equally Split a DE by segment

You can do that with ntile: SELECT SubscriberKey FROM ( SELECT SubscriberKey, ntile(5) over(order by SubscriberKey) as tile_nr /* update number in the bracket ntile(x) for total number of ...
user avatar
  • 2,304
1 vote

Split | character in string

Yes, simply escape the | with: String myString = 'one|two'; myString.split('\\|');
user avatar
1 vote

Random Data Extensions: Need to split larger audience into 20 different DEs

You can do it at least in 2 ways: Split the audience within the Journey. You would create the first Random Split to have 50% + 50% and then from each branch of 50%, you would have another Random ...
user avatar
  • 2,304
1 vote
Accepted

Using SQL to split a data extension into 4 mutually exclusive groups

You could use ntile() with a random order and then build filters for each audience: select m.emailAddress , m.firstName , ntile(4) over (order by newid()) grp from YourMasterDE m Filter 1: ...
user avatar
  • 27.7k
1 vote

Exists in whole word in Decisions Splits in Journey Builder doesn't work

It looks like it was a known issue in Email Studio when using dynamic content: Here However it was allegedly fixed in a new version (216). Couldn't find anything specific for journeys. Maybe try ...
user avatar
  • 149
1 vote
Accepted

Random data extensions: How to create more than 12

If you're just wanting to ID bad bounces, then I'd create a Data Extension with the fields listed on the _Bounce Data View page (plus an emailName, text(100) column and all columns nullable) and a ...
user avatar
  • 27.7k
1 vote

Split method truncating result and appending '...' in the end

I think its issue with logs which shows "..." after some text. Please try this: String s = 'a b c d e f g h i j k l m'; for(String s1 : s.split(' ')){ System.debug('value ' + s1); } Hope this ...
user avatar
  • 479
1 vote

How to automatically create Opportunity Splits through a trigger?

I recently created some automation to modify Opportunity Split percentages and users for the OpportunitySplit standard object via Apex and found that the following approach of 3 DML statements works ...
user avatar
  • 106
1 vote

How to automatically create Opportunity Splits through a trigger?

I don't know that this is an answer but I wanted to share what I have discovered in doing a dataload of Splits. Same as you I can add and remove Opportunity Team members easily but I was getting ...
user avatar
  • 357

Only top scored, non community-wiki answers of a minimum length are eligible