• Olga Shirokova 5
  • NEWBIE
  • 10 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies
Hello,

I need to get a substring from a text. Conditions:
  • starts with W200
  • can be different length
  • can be followed by a space, comma, other character (not a number) or nothing
Examples:
"Test W200123456 test" -> W200123456
"Test W200123" -> W200123
"W200123456789, test" -> W200123456789

I have a code that works if the substring i need is followed by a space.

String myString= 'my order W200454545 tests';
Integer index = myString.indexOf('W200');
Integer index2 = myString.indexOf(' ', index);
String newValue = myString.substring(index, index2);

How can I account for all other options?
Hello,

I need to get a substring from a text. Conditions:
  • starts with W200
  • can be different length
  • can be followed by a space, comma, other character (not a number) or nothing
Examples:
"Test W200123456 test" -> W200123456
"Test W200123" -> W200123
"W200123456789, test" -> W200123456789

I have a code that works if the substring i need is followed by a space.

String myString= 'my order W200454545 tests';
Integer index = myString.indexOf('W200');
Integer index2 = myString.indexOf(' ', index);
String newValue = myString.substring(index, index2);

How can I account for all other options?
I am getting the following error when Refreshing Sales Data through Trailhead Data Manager:
"An error occured in your last data refresh.
Insert failed. First exception on row 78; first error: INVALID_CROSS_REFERENCE_KEY, Owner ID: owner cannot be blank: [OwnerId]"

I was following the steps in trailhead: https://trailhead.salesforce.com/trails/wave_analytics_apps/modules/wave_apps_basics/units/wave_apps_creating_wave_apps