
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Getting a SubField to the left of the last '-' in a string
I am working on a SubString function to get the data to the LEFT of the final dash (-) in the string.
For example:
vString = 'Test - Test Bed 1 - New Form - 1110012'
The expected result would be: Test - Test Bed 1 - New Form
I have used
SubField('Test - Test Bed 1 - New Form - 1110012','-',1)
and it works for the first instance of the - (returning Test) but I need to essentially do it in reverse to get everything from the left of the final -
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here is the expression.
Left('Test - Test Bed 1 - New Form - 1110012',index('Test - Test Bed 1 - New Form - 1110012','-', SubStringCount('Test - Test Bed 1 - New Form - 1110012','-'))-1)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try this.
SubField('Test - Test Bed 1 - New Form - 1110012','-',SubStringCount('Test - Test Bed 1 - New Form - 1110012','-')+1)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That gives me what is to the right of the final (-) which is 1110012. I need what is to the left of it.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ohh My bad, sorry I misunderstood it. I will send you the new expression.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here is the expression.
Left('Test - Test Bed 1 - New Form - 1110012',index('Test - Test Bed 1 - New Form - 1110012','-', SubStringCount('Test - Test Bed 1 - New Form - 1110012','-'))-1)


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
another possible solution might be:
Left('Test - Test Bed 1 - New Form - 1110012',Index('Test - Test Bed 1 - New Form - 1110012','-',-1)-1)
