-3

I need to subtract 1 or more from an alphanumeric as I import data into SQL.

Example:

=IF({src::Comments}="DUPLICATE",STRCAT("X",RIGHT({src::Sample #},6)-1),"NULL")    

Where the src::Sample # is a 7 character alphanumeric.

I thought this should work, but the action fails to return a value.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Tim
  • 1
  • 1
  • Which dbms????? This is probably one of the most important info. Learn how to ask question. https://stackoverflow.com/help/how-to-ask – Eric Mar 09 '18 at 19:58
  • acQuire over SQL 2012 (a geologic data management system) – Tim Mar 09 '18 at 20:00

1 Answers1

0

So after playing with this I found the following that works,

=IF({src::Comments}="DUPLICATE",STRCAT("X",DIFF(RIGHT({src::Sample #},6),1)),"NULL")

Using the DIFF function at the start of argument in the second part of the STRCAT function returns a valid result.

Tim
  • 1
  • 1